draw_group
Draws ONE region of the diagram in a single call: a container, the nodes inside it, and the edges that touch those nodes. This is THE way to build a diagram in a live document. A human is watching the canvas, and the server draws the items one at a time in the order a person would — the container, then each node followed at once by its edges — at a readable pace (a call takes about 0.7 s per item before it returns). Build a diagram as a series of draw_group calls, one region per call, issued ONE AFTER ANOTHER (never in parallel): finish a region before starting the next, and position each new region from the previous result's nextFree. Never create all the containers first, then all the nodes, then all the connections. The result reports where things landed: "placed" (centre x/y and size w/h), the "container" box grown around its nodes, "overlaps" when something landed on top of something else, "nextFree" (top-left corners of clear space to the right of and below the whole diagram — positions are centres, so add half your region's width/height), and sometimes a "hint" — act on it. Layout: nodes are about 150 wide × 50 tall; space node centres ~180 apart horizontally and ~100–160 vertically; leave 60–100 units of clear space between the EDGES of neighbouring containers (a container extends ~40 beyond its outermost nodes, plus a label strip on top), and size each region from its own node count rather than using one uniform grid. Everything is validated before anything is drawn. At most 25 items (container + nodes + connections) per call — split a larger region. Also usable without "container" to add free-standing nodes and edges, or nodes into an existing container (set node.container). Requires a valid editor access token.
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": {
"token": "<token>",
"agentId": "<agentId>"
},
"name": "draw_group"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nodes | No | The nodes of this region, in the order they should appear (follow the flow: source before target). Give each its final x/y. | |
| token | Yes | Editor access token for this document. The document ID is embedded in the token. | |
| agentId | Yes | YOUR AI assistant name (e.g. "Claude.ai", "GitHub Copilot"). Shown as "[agentId] working with [userName]" in the collaboration presence dot. | |
| userName | No | First name of the human you are assisting (ask them at session start if you do not know). Shown in the collaboration presence dot as "[agentId] working with [userName]". | |
| container | No | Optional: the NEW container this region is drawn in. Nodes in this call go inside it unless they set their own "container". Omit to draw free-standing nodes, or to add to a container that already exists. | |
| connections | No | Edges touching this region. Each end may be a node or container in this call OR one already on the canvas — so include the edges that link this region back to earlier ones. Each edge is drawn the moment both of its ends exist. | |
| action_explanation | No | Optional: what this region is and why (max 250 chars). Shown live to human collaborators in the AI cursor tooltip while it is drawn. |