Make state diagram
make_state_diagramUse this when the user wants a UML state diagram or state machine drawn, for example "draw the states of an order" or "make a PDF of this state machine". Takes the diagram text in a line grammar: state Name / state "Long label" as Name / state Name <> / state Name { ... } (composite, nest up to 3); [] -> A (start), A -> [] (end); A -> B: event [guard] / action; A -> A: event (self); note A: text; # comments. When the user describes the machine in words, write it in this grammar first. Returns counts, states, transitions in input order, the machine check (unreachable states, states with no path to the end, non-deterministic transitions), a check on the drawing, the PDF page count, an interactive diagram, and PDF, SVG and CSV downloads. Refuses a line outside the grammar with its line number and token. Up to 80 states and 300 transitions. Does not read fork, join, history or concurrent regions. Download links of large diagrams expire after about 1 hour.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"diagram": "<diagram>"
},
"name": "make_state_diagram"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Title printed on the diagram and used in file names, up to 80 characters, e.g. "Order lifecycle". | |
| diagram | Yes | The state machine in this line grammar, one statement per line, up to 40,000 characters: state Name | state "Long label" as Name | state Name <<choice>> | state Name { ... } (composite, nest up to 3); [*] -> A (start), A -> [*] (end); A -> B: event [guard] / action (after ':' the event is required, then an optional [guard] and / action in that order; only a transition out of a <<choice>> state may have a [guard] without an event); note A: text; # comments. Declare each state before or after use. Example: "state Idle\nstate Running\n[*] -> Idle\nIdle -> Running: start [ready] / log\nRunning -> Idle: stop\nRunning -> [*]: shutdown". | |
| page_size | No | PDF paper, portrait: letter (default) or a4. Example: a4. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | |||
| shown | No | ||
| title | Yes | ||
| counts | Yes | ||
| states | Yes | ||
| analysis | Yes | ||
| warnings | Yes | ||
| downloads | Yes | ||
| transitions | Yes | ||
| layout_check | Yes |