Draw a Diagram from an Agent
This tutorial drives the shared canvas from a connected CLI agent, using only MCP tool calls. By the end, a shape you created from the agent session is visible on the canvas.
Before you start
- NEXUS is running.
- A CLI is connected as an MCP client of
nexus-mcp— see Connect a CLI if it is not yet. - You have made a discovery call and read the response back — see First tool call.
1. Discover the canvas tools
Ask your connected agent to call server/discover (or make the call yourself, if your CLI exposes a raw tool-call surface). The response's capabilities enumerate the canvas tool namespace for the session. The exact tool names, parameters, and result shapes are in the MCP tools reference — keep it open alongside this tutorial.
2. Call a canvas tool
Every tool call on this server shares one envelope, regardless of namespace:
{
"jsonrpc": "2.0",
"id": 10,
"method": "tools/call",
"params": {
"name": "canvas_<tool-name-from-discovery>",
"arguments": {}
},
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28"
}
}Replace canvas_<tool-name-from-discovery> and arguments with the actual tool name and parameters from the tools reference. In practice, you will not write this call by hand — ask the agent in plain language, for example "draw a rectangle labeled 'Q3 plan' on the canvas," and let it fill in the call from what discovery told it.
3. Confirm it landed
Open the canvas surface in NEXUS. The shape the agent created should be visible immediately — the canvas is shared state, not a private view the agent renders for itself.
What just happened
The agent never learned a NEXUS-specific drawing API. It called server/discover, read a tool signature it had never seen before, and used it — the same way it would use any other MCP server's tools. That is the point of exposing the canvas this way: no NEXUS-specific client code, no separate SDK to install.
Next
Try Agent-to-agent handoff to coordinate two agent sessions instead of one, or read Canvas for the full guide to what the canvas tools can do.