Draw a Diagram from an Agent
Use your connected agent to create a canvas and add a simple shape. You will finish with a change you can inspect in Nexus, rather than an image returned only in chat.
Before you start
Keep Nexus running with a workspace open and connect an MCP client. Follow First tool call until tools/list works. The calling agent needs permission for the tools below; your autonomy mode may ask you to approve writes.
1. Find the tools
Ask the agent to list tools from the local Nexus server. Confirm that canvas_create, canvas_get_state, and canvas_create_elements are advertised. Their descriptions begin with [Local NEXUS app].
server/discover describes the server. It does not replace tools/list or provide each tool's input schema.
2. Create or select the canvas
Ask:
Use the local Nexus tools to open a canvas named “First diagram”. Reuse that canvas if it already exists, and show a preview.
The corresponding tool arguments are:
{
"name": "canvas_create",
"arguments": {
"title": "First diagram",
"attachPreview": true
}
}These are the params for tools/call. Modern clients also include params._meta as shown in the first-call guide.
Expected result: a created or resolved canvas ID and a preview. A new canvas gives its creating agent owner access. Resolving an existing canvas gives an agent with no grant editor access. An ambiguous title is refused; choose the intended canvas rather than making another one.
3. Read before drawing
Call canvas_get_state with that canvas ID. Note the returned revision and role.
{
"name": "canvas_get_state",
"arguments": {
"canvasId": "<canvas-id-from-step-2>"
}
}Ask the agent to add one rectangle, using the actual revision it just read:
{
"name": "canvas_create_elements",
"arguments": {
"canvasId": "<canvas-id-from-step-2>",
"elements": [
{
"id": "first-diagram-box",
"type": "rectangle",
"x": 80,
"y": 80,
"width": 240,
"height": 120,
"strokeColor": "#3155d9",
"backgroundColor": "#e8edff"
}
],
"expectedRevision": 0,
"reason": "Add the first diagram box"
}
}The 0 above is an example, not a revision to copy blindly. Use a fresh element ID if that ID already exists. Do not edit the stored canvas file to perform the write.
4. Check the outcome
| Outcome | What to do |
|---|---|
applied | Inspect the rectangle in the Nexus canvas. |
proposed | Review the pending proposal; the drawing has not been applied yet. |
conflict | Read the canvas again, reconsider the edit, and use its new revision. |
rejected or a tool error | Read the reason and fix access, editing settings, or arguments before retrying. |
Success means: the result says applied and the rectangle is visible in the intended canvas. An accepted proposal alone does not satisfy that check.
Next
Continue with canvas conflicts, or try Agent-to-agent handoff.