Tools reference
Every tool the Penna connector gives your AI app, with its parameters, exactly as the AI sees them.
These are the tools your AI app gets when you connect it. The in-app assistant uses the same diagram tools, without diagram_id, because it always works on the diagram you have open. Select a tool to see its full description and parameters.
| Tool | What it does | Read-only |
|---|---|---|
get_diagram | Read diagram | Yes |
write_diagram | Replace diagram | No |
edit_diagram | Edit diagram | No |
read_comments | Read comments | Yes |
lookup_guidance | Look up BPMN guidance, Look up sequence diagram guidance, Look up ER diagram guidance | Yes |
list_diagrams | List diagrams | Yes |
open_diagram | Show diagram in the app | No |
create_diagram | Create diagram | No |
read_context | Read business context | Yes |
save_learning | Save learning | No |
show_diagram | Show diagram | Yes |
The connector also has load_diagram_card, edit_from_card, which only the diagram card calls, to load its picture and make the changes you make in it. Chats that show the card hide them from the AI.
Tools
Read diagram. Read the diagram as Flowmark markup, with every node's #id and the current modeling-rule issues. Call this before editing if you have not seen the latest version (the user may have edited it by hand).
For a sequence diagram: its code with every element's id, and the current issues.
For an ER diagram: its schema code with every element's id, and the current issues.| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes | From list_diagrams or create_diagram. |
Replace diagram. Replace the whole diagram with new Flowmark markup. Use it to draft a new process or to restructure most of one; use edit_diagram for small changes. Layout and wiring are automatic. Returns the element ids and modeling-rule issues, or a line-numbered syntax error to fix.
Flowmark in brief (lookup_guidance "flowmark" has the full reference):
process <name>
lanes <A> | <B> optional lane order
lane <name> following nodes go in this lane
<kind>[:<event>[(<arg>)]] <name> [#id]
kinds: start end catch throw task user service manual script rule send receive call sub xor and or eventgw
events: message timer error signal conditional escalation terminate compensation; timer args are ISO 8601 (P2D, PT4H)
Indented lines under a node:
<label> [<condition>] (default) -> <target> explicit flow
on:<event>(<arg>) <name> -> <target> interrupting boundary event (on~ for non-interrupting)
doc: <text> documentation, hidden; one line each (before the first node: the process's)
note: <text> a short note shown beside the node; one line per note: line
=> <pool>: <message> sends a message to an outside pool; <= <pool>: <message> receives one
pool <name> [(below)] an outside party as a black-box pool, above the process unless (below)
Each node connects to the node on the line above; a blank line starts a new path. Nodes with -> lines, and end events, don't continue. Targets are names or #id; give unnamed or duplicate-named nodes an #id (e.g. "xor #merge").
For a sequence diagram, write sequence code (lookup_guidance "sequence-code" has the rest):
title <name>; actor/participant/database <name> [as <alias>]
A->B: call B-->A: reply A->>B: async A->B ++ / -- starts or ends a bar
alt <cond> ... else <cond> ... end; opt, loop, par (and), break, critical, group
note over A, B: text; == Phase ==
For an ER diagram, write schema code (DBML; lookup_guidance "schema-code" has the syntax). Call read_context once per chat before your first change, for the team's names and rules.| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes | From list_diagrams or create_diagram. |
markup | string | Yes | The complete process in Flowmark. |
For a sequence diagram: the complete diagram in sequence code.
For an ER diagram: the complete diagram in schema code. |
Edit diagram. Apply targeted edits to the diagram. Prefer this to write_diagram for small changes: it keeps element ids (and the user's references) stable. The batch is atomic: if one operation fails, none apply and the error says what to fix. Nodes and lanes can be referenced by id or exact name. Returns the updated diagram and its modeling-rule issues.
For a sequence diagram: operations on participants, messages, notes, dividers and fragments; participants by id, alias or name, items by id.
For an ER diagram: operations on tables, columns, relationships, enums, groups and indexes; tables by id or name, columns by id or table.column. Call read_context once per chat before your first change, for the team's names and rules.| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes | From list_diagrams or create_diagram. |
operations | array of operations | Yes |
Each entry in operations is one of the operations below.
Read comments. Read the open comments the user left on the diagram's elements: notes for themselves and for you, such as changes to make or questions to settle. Each comes with the elements it is on (name and id) and its replies. get_diagram says how many are open. Comments are read-only for you; when you have addressed some, say which, so the user can resolve them.
| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes | From list_diagrams or create_diagram. |
Look up BPMN guidance, Look up sequence diagram guidance, Look up ER diagram guidance. Look up the app's curated guidance: the Flowmark syntax ("flowmark"), modeling style, structural patterns, or a domain reference process (typical roles, steps, decisions, exceptions and KPIs). Use it before drafting in a known domain, or when unsure of the syntax or a pattern.
For a sequence diagram: the syntax ("sequence-code"), drawing style ("sequence-style") and reference interactions (api-request, cache-aside, oauth-sign-in, webhook-retries, queue-async, payment-3ds).
For an ER diagram: the syntax ("schema-code") and modeling style ("schema-style").| Parameter | Type | Required | Description |
|---|---|---|---|
topic | "flowmark" | "modeling-style" | "gateways" | "events-and-exceptions" | "pools-and-messages" | "approval" | "escalation-and-sla" | "layout-and-polish" | "change-management" | "customer-support" | "employee-onboarding" | "incident-management" | "insurance-claims" | "kyc-onboarding" | "loan-origination" | "month-end-close" | "order-to-cash" | "patient-referral" | "permit-application" | "procure-to-pay" | "recruitment" | "returns-and-refunds" | "sequence-code" | "sequence-style" | "api-request" | "cache-aside" | "oauth-sign-in" | "webhook-retries" | "queue-async" | "payment-3ds" | "schema-code" | "schema-style" | Yes |
List diagrams. List the diagrams saved in the user's Penna, with their diagram_id, name, kind, size, and which one is open in the app.
No parameters.
Show diagram in the app. Show a diagram in the user's app, so they can watch it while you work. It doesn't change which diagram the other tools act on; they take a diagram_id.
| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes |
Create diagram. Create a new, empty diagram, open it in the app, and return its diagram_id. Follow up with write_diagram to draft it. Call read_context once per chat before your first change, for the team's names and rules.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The diagram's name. |
kind | "bpmn" | "sequence" | "erd" | The kind of diagram: bpmn (BPMN process), sequence (Sequence diagram), erd (ER diagram). Default bpmn. |
Read business context. Read what the user's team wrote about their business (roles and teams, systems, the names they use, approval limits, deadlines) and the learnings they saved from earlier corrections. Call it once per chat before your first create_diagram, write_diagram or edit_diagram, and use their names and rules instead of generic ones. The user's request wins when it says otherwise.
| Parameter | Type | Required | Description |
|---|---|---|---|
kind | "bpmn" | "sequence" | "erd" | The kind of diagram you're working on, for the learnings about it. Leave out for every kind. |
Save learning. Save a learning for the user's team: one rule about their business that the in-app assistant and you will follow from now on, such as "Loans over $250k go to the Credit Committee." Only when the user asks you to remember something, or agrees when you offer to after they corrected you. Write about roles, systems and rules, never a named person, contact details or a secret, in one sentence under 300 characters. They can see and remove it in the app.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The rule, as one standalone sentence. |
kind | "bpmn" | "sequence" | "erd" | The kind of diagram it's about. Leave out when it holds for every kind. |
Show diagram. Show the user a diagram as an interactive picture in the chat, where the chat can display one; elsewhere the result is a link to it in the app. Use it when the user wants to see a diagram without changing it. write_diagram and edit_diagram show the diagram after every change by themselves, so don't call it after them.
| Parameter | Type | Required | Description |
|---|---|---|---|
diagram_id | string | Yes | From list_diagrams or create_diagram. |
Operations
Each entry in edit_diagram's operations is one of these, picked by its op field. The batch is atomic: if one operation fails, none apply.
Add a node. after/before connect it in the same step.
| Parameter | Type | Required | Description |
|---|---|---|---|
type | "startEvent" | "endEvent" | "intermediateCatchEvent" | "intermediateThrowEvent" | "boundaryEvent" | "task" | "userTask" | "serviceTask" | "manualTask" | "scriptTask" | "businessRuleTask" | "sendTask" | "receiveTask" | "callActivity" | "subProcess" | "exclusiveGateway" | "parallelGateway" | "inclusiveGateway" | "eventBasedGateway" | Yes | |
name | string | Activities: verb + object. Events: a state. Decision gateways: a question. | |
lane | string | Lane id or name. Required when the process has lanes (boundary events take their host's lane). | |
eventDefinition | "none" | "message" | "timer" | "error" | "signal" | "conditional" | "escalation" | "terminate" | "compensation" | Events only. | |
timer | string | Timer events: ISO 8601 duration, date or cycle, e.g. P2D, PT4H, R/P1W. | |
attachedTo | string | Boundary events: the activity they attach to (id or name). | |
cancelActivity | boolean | Boundary events: false for non-interrupting. Default true. | |
documentation | string | Free-text documentation, not shown on the diagram. | |
note | string | A short note shown on the diagram beside the node, e.g. "SLA 24 hours". Several lines allowed; "" removes it. Not on boundary events. | |
id | string | Optional id to give the node. | |
after | string | Connect from this node: a node id or its exact name. | |
before | string | Connect to this node: a node id or its exact name. | |
flowName | string | Label of the flow from after, e.g. a gateway answer. | |
condition | string | Condition of the flow from after. |
Change a node's fields.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The node: a node id or its exact name. |
type | "startEvent" | "endEvent" | "intermediateCatchEvent" | "intermediateThrowEvent" | "boundaryEvent" | "task" | "userTask" | "serviceTask" | "manualTask" | "scriptTask" | "businessRuleTask" | "sendTask" | "receiveTask" | "callActivity" | "subProcess" | "exclusiveGateway" | "parallelGateway" | "inclusiveGateway" | "eventBasedGateway" | ||
name | string | Activities: verb + object. Events: a state. Decision gateways: a question. | |
lane | string | Lane id or name. Required when the process has lanes (boundary events take their host's lane). | |
eventDefinition | "none" | "message" | "timer" | "error" | "signal" | "conditional" | "escalation" | "terminate" | "compensation" | Events only. | |
timer | string | Timer events: ISO 8601 duration, date or cycle, e.g. P2D, PT4H, R/P1W. | |
attachedTo | string | Boundary events: the activity they attach to (id or name). | |
cancelActivity | boolean | Boundary events: false for non-interrupting. Default true. | |
documentation | string | Free-text documentation, not shown on the diagram. | |
note | string | A short note shown on the diagram beside the node, e.g. "SLA 24 hours". Several lines allowed; "" removes it. Not on boundary events. |
Remove a node and its flows.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The node: a node id or its exact name. |
reconnect | boolean | Bridge a single incoming and outgoing flow. Default true. |
Connect two nodes.
| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Source node: a node id or its exact name. |
target | string | Yes | Target node: a node id or its exact name. |
name | string | Label, e.g. a gateway answer. | |
condition | string | Condition expression. | |
isDefault | boolean | The default flow of a gateway or activity. |
Change or re-route a flow.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Flow id. Or identify the flow by source and target. | |
source | string | Source node: a node id or its exact name. | |
target | string | Target node: a node id or its exact name. | |
name | string | New label. | |
condition | string | New condition. | |
isDefault | boolean | Make it the default flow. | |
newSource | string | New source: a node id or its exact name. | |
newTarget | string | New target: a node id or its exact name. |
Remove a flow.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Flow id. Or identify the flow by source and target. | |
source | string | Source node: a node id or its exact name. | |
target | string | Target node: a node id or its exact name. |
Split a flow with a new node.
| Parameter | Type | Required | Description |
|---|---|---|---|
flow | string | Flow id. Or identify the flow by source and target. | |
source | string | Source node: a node id or its exact name. | |
target | string | Target node: a node id or its exact name. | |
node | object | Yes |
Add a lane (a role or department).
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Lane name. |
id | string | Optional id. | |
index | integer | Position, 0 = top. |
Rename or move a lane.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Lane id or name. |
name | string | New name. | |
index | integer |
Remove a lane.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Lane id or name. |
moveTo | string | Lane to move its nodes to. |
Rename the process or set its documentation.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Process name. | |
documentation | string | Documentation. |
Add an outside party (customer, supplier, carrier, bank) as a black-box pool: it shows what it sends and receives, not its steps. Your own roles are lanes.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | The party, e.g. Customer. |
id | string | Optional id. | |
below | boolean | Draw it below the process. Default: above. |
Rename a pool or move it above or below the process.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Pool id or name. |
name | string | New name. | |
below | boolean | true: below the process; false: above. |
Remove a pool and its messages.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Pool id or name. |
Add a message between a step and an outside pool, e.g. from a send task to the Carrier pool, or from the Customer pool to a message start event.
| Parameter | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Sender: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. |
target | string | Yes | Receiver: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. |
name | string | What is sent, e.g. "Pickup request". | |
id | string | Optional id. |
Rename a message or move one of its ends.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Message id (get_diagram lists them). Or identify the message by source and target. | |
source | string | Sender: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. | |
target | string | Receiver: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. | |
name | string | New name. | |
newSource | string | New sender: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. | |
newTarget | string | New receiver: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. |
Remove a message.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Message id (get_diagram lists them). Or identify the message by source and target. | |
source | string | Sender: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. | |
target | string | Receiver: a step (node id or name) or an outside pool (pool id or name). One end is a step, the other a pool. |
Change how the diagram is laid out, not the process: how far apart steps sit, and putting steps moved by hand back in their automatic spots. For requests about spacing, room, readability or tidying the layout; lookup_guidance("layout-and-polish") says which to pick. Spacing steps, tightest first: compact, standard (the default), roomy, spacious.
| Parameter | Type | Required | Description |
|---|---|---|---|
spacing | "compact" | "standard" | "roomy" | "spacious" | Both ways at once. | |
across | "compact" | "standard" | "roomy" | "spacious" | Between columns of steps, left to right. Overrides spacing for this direction. | |
down | "compact" | "standard" | "roomy" | "spacious" | Between rows of steps and between lanes. Overrides spacing for this direction. | |
tidy | boolean | Put every step moved by hand back in its automatic spot. |
Set the title, or number the messages.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | The title; "" removes it. | |
autonumber | boolean | Number messages 1, 2, 3. |
Add a participant: a system, service or role. Messages add the ones they name, so this is for its kind, alias or column.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Its name. |
kind | "participant" | "actor" | "database" | actor for a person, database for a data store. Default participant. | |
alias | string | A short name the code uses for it. | |
id | string | Optional id. | |
index | integer | Column, 0 = leftmost. Default: the end. |
Rename a participant, change its kind or alias, or move its column.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The participant: a participant id, alias or name. |
name | string | New name. | |
kind | "participant" | "actor" | "database" | actor for a person, database for a data store. Default participant. | |
alias | string | New alias; "" removes it. | |
index | integer | New column, 0 = leftmost. |
Add a message. Without a position it goes at the end.
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Sender: a participant id, alias or name. A name the diagram doesn't have adds that participant. |
to | string | Yes | Receiver; the sender for a message to itself: a participant id, alias or name. A name the diagram doesn't have adds that participant. |
text | string | A verb phrase, e.g. "Request token". \n for a line break. | |
arrow | "call" | "reply" | "async" | call waits for an answer, reply is that answer, async doesn't wait. Default call. | |
activate | boolean | The receiver becomes active (++). | |
deactivate | boolean | The sender's activation ends (--). | |
id | string | Optional id. | |
after | string | Put it right after this item: an item id (get_diagram lists them). | |
before | string | Put it right before this item: an item id (get_diagram lists them). | |
fragment | string | Put it at the end of this fragment: an item id (get_diagram lists them). | |
branch | integer | With fragment: which branch, 0 = the first. Default 0. |
Change a message's text, arrow, ends or activation.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The message: an item id (get_diagram lists them). |
from | string | New sender: a participant id, alias or name. A name the diagram doesn't have adds that participant. | |
to | string | New receiver: a participant id, alias or name. A name the diagram doesn't have adds that participant. | |
text | string | A verb phrase, e.g. "Request token". \n for a line break. | |
arrow | "call" | "reply" | "async" | call waits for an answer, reply is that answer, async doesn't wait. Default call. | |
activate | boolean | The receiver becomes active (++). | |
deactivate | boolean | The sender's activation ends (--). |
Add a note. Without a position it goes at the end.
| Parameter | Type | Required | Description |
|---|---|---|---|
on | array of string | Yes | The participants it's on (ids, aliases or names): one, or several for over. |
position | "over" | "left" | "right" | over the participants, or left or right of one. Default over. | |
text | string | Yes | Its text; several lines allowed. |
id | string | Optional id. | |
after | string | Put it right after this item: an item id (get_diagram lists them). | |
before | string | Put it right before this item: an item id (get_diagram lists them). | |
fragment | string | Put it at the end of this fragment: an item id (get_diagram lists them). | |
branch | integer | With fragment: which branch, 0 = the first. Default 0. |
Change a note's text or where it sits.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The note: an item id (get_diagram lists them). |
on | array of string | The participants it's on (ids, aliases or names): one, or several for over. | |
position | "over" | "left" | "right" | over the participants, or left or right of one. Default over. | |
text | string | New text. |
Add a divider that names a phase, e.g. Checkout.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Its label. |
id | string | Optional id. | |
after | string | Put it right after this item: an item id (get_diagram lists them). | |
before | string | Put it right before this item: an item id (get_diagram lists them). | |
fragment | string | Put it at the end of this fragment: an item id (get_diagram lists them). | |
branch | integer | With fragment: which branch, 0 = the first. Default 0. |
Change a divider's label.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The divider: an item id (get_diagram lists them). |
text | string | Yes | New label. |
Move a message, note, divider or fragment.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The item: an item id (get_diagram lists them). |
after | string | Put it right after this item: an item id (get_diagram lists them). | |
before | string | Put it right before this item: an item id (get_diagram lists them). | |
fragment | string | Put it at the end of this fragment: an item id (get_diagram lists them). | |
branch | integer | With fragment: which branch, 0 = the first. Default 0. |
Put items that sit next to each other in a fragment: alt for conditions, opt for one optional part, loop for repeats and retries, par for parallel work, break to stop, critical, or group.
| Parameter | Type | Required | Description |
|---|---|---|---|
items | array of string | Yes | The ids of the items. |
kind | "alt" | "opt" | "loop" | "par" | "break" | "critical" | "group" | Yes | |
condition | string | The guard or label, e.g. "card declined" or "every 5 minutes". | |
id | string | Optional id. |
Change a fragment's kind, or a branch's condition.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The fragment: an item id (get_diagram lists them). |
kind | "alt" | "opt" | "loop" | "par" | "break" | "critical" | "group" | ||
condition | string | New condition. | |
branch | integer | Which branch's condition, 0 = the first. Default 0. |
Add an else branch to an alt, or an and branch to a par.
| Parameter | Type | Required | Description |
|---|---|---|---|
fragment | string | Yes | The fragment: an item id (get_diagram lists them). |
condition | string | Its condition. |
Remove a branch of an alt or par and what it holds.
| Parameter | Type | Required | Description |
|---|---|---|---|
fragment | string | Yes | The fragment: an item id (get_diagram lists them). |
branch | integer | Yes | Which branch, 0 = the first. |
Remove a fragment, keeping what it holds in its place.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The fragment: an item id (get_diagram lists them). |
Remove a participant (with its messages) or an item (a fragment with what it holds).
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | A participant id or an item id. |
Set the schema's name, database or note.
| Parameter | Type | Required | Description |
|---|---|---|---|
title | string | Its name; "" removes it. | |
database | string | PostgreSQL, MySQL, SQL Server, SQLite or Oracle. | |
note | string | A note on the schema; "" removes it. |
Add a table with its columns. A column's references adds its relationship too.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | snake_case and plural, e.g. order_items. |
columns | array of object | Yes | Its columns, the primary key first. |
schema | string | Its schema, when not the default. | |
group | string | A group id or name to put it in. | |
note | string | What a row is. | |
id | string | Optional id. | |
index | integer | Its place among the tables. Default: the end. |
Rename a table, or change its schema, alias, note, group or place.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The table: a table id or name. |
name | string | New name. | |
schema | string | New schema; "" for the default. | |
alias | string | Short name; "" removes it. | |
note | string | "" removes it. | |
group | string | A group id or name; "" takes it out of its group. | |
color | string | Header colour, #RRGGBB. | |
index | integer | New place among the tables. |
Add a column to a table.
| Parameter | Type | Required | Description |
|---|---|---|---|
table | string | Yes | The table: a table id or name. |
name | string | Yes | snake_case, e.g. customer_id. |
type | string | Yes | A type for the database, e.g. integer, bigint, varchar(255), text, timestamp, boolean, decimal(10,2), or an enum's name. |
pk | boolean | Part of the primary key. | |
unique | boolean | No two rows share a value. | |
not_null | boolean | Every row has a value. | |
increment | boolean | Numbered automatically. | |
default | string | Default value: 0, true, 'draft', or an expression such as now(). "" removes it. | |
note | string | What the column holds, when the name doesn't say. | |
references | string | table.column it points at; adds a many-to-one relationship. | |
id | string | Optional id. | |
after | string | Put it right after this column: a column id, or table.column. | |
before | string | Put it right before this column: a column id, or table.column. | |
index | integer | Its place, 0 = first. Default: the end. |
Rename a column, or change its type, key, constraints, default or note.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The column: a column id, or table.column. |
name | string | snake_case, e.g. customer_id. | |
type | string | A type for the database, e.g. integer, bigint, varchar(255), text, timestamp, boolean, decimal(10,2), or an enum's name. | |
pk | boolean | Part of the primary key. | |
unique | boolean | No two rows share a value. | |
not_null | boolean | Every row has a value. | |
increment | boolean | Numbered automatically. | |
default | string | Default value: 0, true, 'draft', or an expression such as now(). "" removes it. | |
note | string | What the column holds, when the name doesn't say. |
Move a column within its table.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The column: a column id, or table.column. |
after | string | Put it right after this column: a column id, or table.column. | |
before | string | Put it right before this column: a column id, or table.column. | |
index | integer | Its place, 0 = first. Default: the end. |
Relate columns: from holds the reference (the foreign key), to is what it points at, usually a primary key.
| Parameter | Type | Required | Description |
|---|---|---|---|
from | Yes | The referencing columns: table.column, or for a composite key table.(a, b) or a list of table.column. | |
to | Yes | The referenced columns: table.column, or for a composite key table.(a, b) or a list of table.column. | |
cardinality | "many-to-one" | "one-to-one" | "many-to-many" | many-to-one: many rows of from point at one row of to (a foreign key). one-to-one: at most one each. many-to-many: better as a junction table. Default many-to-one. | |
name | string | The constraint's name. | |
on_delete | "cascade" | "restrict" | "set null" | "set default" | "no action" | What happens to the referencing rows when the referenced row is deleted. | |
on_update | "cascade" | "restrict" | "set null" | "set default" | "no action" | What happens to the referencing rows when the referenced row is changed. | |
id | string | Optional id. |
Change a relationship's cardinality, name or actions, or swap its ends.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The relationship's id. |
cardinality | "many-to-one" | "one-to-one" | "many-to-many" | many-to-one: many rows of from point at one row of to (a foreign key). one-to-one: at most one each. many-to-many: better as a junction table. Default many-to-one. | |
name | string | "" removes it. | |
on_delete | "cascade" | "restrict" | "set null" | "set default" | "no action" | "" | What happens to the referencing rows when the referenced row is deleted. | |
on_update | "cascade" | "restrict" | "set null" | "set default" | "no action" | "" | What happens to the referencing rows when the referenced row is changed. | |
flip | boolean | Swap from and to. |
Add an enum: a type with a fixed list of values. Set a column's type to its name to use it.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | snake_case, e.g. order_status. |
values | array of string | Yes | Its values, e.g. pending, paid, shipped. |
id | string | Optional id. |
Rename an enum (its columns follow) or replace its values.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The enum's id or name. |
name | string | New name. | |
values | array of string | The full new list of values. |
Group tables that belong to one area, such as billing or catalog. A table is in one group at most.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Its name. |
tables | array of string | Table ids or names to put in it. | |
note | string | What the area covers. | |
id | string | Optional id. |
Rename a group, set its tables or note.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The group's id or name. |
name | string | New name. | |
tables | array of string | The full new list of tables. | |
note | string | "" removes it. |
Add an index, or a composite primary key or unique constraint.
| Parameter | Type | Required | Description |
|---|---|---|---|
table | string | Yes | The table: a table id or name. |
columns | array of string | Yes | Column names, or expressions in backticks. |
unique | boolean | A unique index. | |
pk | boolean | The primary key, for one over several columns. | |
name | string | Its name. | |
type | string | btree, hash and the like. |
Remove an index.
| Parameter | Type | Required | Description |
|---|---|---|---|
table | string | Yes | The table: a table id or name. |
columns | array of string | Yes | Its columns, as listed. |
Add a note of its own to the diagram.
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Its text; several lines allowed. |
name | string | Its name. | |
id | string | Optional id. |
Change a note's text or name.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The note's id or name. |
text | string | New text. | |
name | string | New name. |
Remove a table (with its relationships), a column (with its relationships), a relationship, an enum, a group (keeping its tables) or a note.
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Its id, or table.column for a column. |
Server instructions
The connector also sends these instructions when an AI app connects. Some clients shorten or ignore them, which is why the tools carry what they need in their own descriptions.
Penna: tools to draft and edit BPMN 2.0 process diagrams saved in the user's account. The app lays out and wires diagrams automatically; you change the structure and spacing. If the app is open, it updates live.
Workflow
1. Pick the diagram. list_diagrams shows ids and which one is open in the app ("this diagram" usually means that one); create_diagram makes a new one.
2. Before your first write, call lookup_guidance with topic "flowmark" for the markup syntax. Look up "modeling-style" or a domain topic when it fits the process.
3. Draft with write_diagram, happy path first. Change an existing diagram, fixes included, with edit_diagram so element ids stay stable. Call get_diagram first if the user may have edited it by hand; it also counts their comments, which read_comments reads.
4. Every change returns checks. Fix every error, and every warning that is a real problem, before you finish. A fix keeps everything else as it is. When it depends on what the user meant, such as a step connected to nothing, ask the user what it is for before you connect or remove it; don't guess.
5. Finish with a short summary of what you built and the assumptions you made, with the link to the diagram that ends each result. Don't paste the markup back.
Modeling rules: activities are verb + object, events are states, decision gateways are questions and their flows are answers. Explicit start events and distinct, named end events. A gateway for every split and merge. Lanes for roles; outside parties as pools with messages. Deadlines and failures as boundary events on the activity. Specific task types. 5-20 activities per diagram.
Sequence diagrams: look up "sequence-code" before your first write. Calls are ->, replies -->, async ->>; alt/else, opt, loop and par wrap messages and close with end. Use actor and database for people and data stores; aim for 3-8 participants.
ER diagrams: look up "schema-code" (DBML) before your first write. A primary key on every table, ref: > on each foreign key; many-to-many is a junction table.