Skip to main content
Glama

Read the canvas

canvas-read
Read-only

Read the canvas of an artifact the person has open in Agent Grid's Live Canvas. action picks what to read, and takes the parameters listed with it:

  • outline [rootId, depth]: Cheap orientation map of the open design file: pages, then one line per node — id, type, name, position (parent-local), size, flags. Flags: artboard; live-page (its layers are a snapshot of a running page — canvas-read action=html returns the page, canvas-replace_html swaps it); auto-layout:; img: (an image fill, reusable in your own fills); ref: on an instance; hidden; locked. Call this first; use the ids it returns with every other tool.

  • html [id required]: The canonical serialized HTML of a node subtree (pass a node id, e.g. an artboard from canvas-read action=outline) or a whole page (pass a page id). This is the document format itself: elements carry data-ac-* attributes (data-ac-model JSON = geometry/fills/effects, data-ac-layout = auto-layout, data-ac-text = typography; text content is the element text). Image fills reference assets as ../../assets/. Edit this HTML and send it back via canvas-replace_html / canvas-insert_html. Exception: for the artboard of a live page (an HTML page that runs its own scripts — see canvas-insert_html) it returns that page's own HTML as written, scripts included, with the user's unsaved canvas edits merged in; edit it and send the whole page back with canvas-replace_html on the artboard.

  • selection: The user's current selection: node ids + world-space bounding box. The shared pointer between user and agent — “make this blue” starts here.

  • screenshot [nodeId, scale]: Render a node/artboard to a PNG image for your own eyes — visual ground truth from the export renderer. Defaults to the selection, else the first artboard. Use it to check your own work after edits. For an image the user keeps, use canvas-read action=export_png.

  • assets: The file's image asset manifest (id, mime, dimensions). Reuse an existing assetId in an image fill instead of re-uploading identical bytes.

  • pages: Pages in the open file (id, name, which is current).

  • export_html [nodeId required]: Export a node/artboard as a standalone HTML document with every asset inlined as data: URIs — opens in any browser as-is. (canvas-read action=html is the lighter read for editing; this is the shippable deliverable.)

  • export_png [nodeId required, scale]: Export a node/artboard as PNG bytes. scale 2 (default) stamps pixel density so the image pastes back at logical size.

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": {
      "sessionId": "<sessionId>",
      "action": "<action>"
    },
    "name": "canvas-read"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNohtml: Node id or page id
depthNooutline: Levels to show, counting the page (or rootId) as the first: default 3 for the page (its artboards and their direct children), 4 under a rootId
scaleNoscreenshot: Render scale, 0.25–2. Default: the longer side fits 1200 px, at most scale 1 and at least 0.25 (a page taller than 4800 px comes out taller; screenshot a section of it instead); export_png: Render scale 0.25–4, default 2
actionYesOne of: outline, html, selection, screenshot, assets, pages, export_html, export_png.
nodeIdNoscreenshot: Node to render (default: selection or first artboard); export_html: Node id (usually an artboard); export_png: Node id
rootIdNooutline: Node id to outline from (defaults to the current page)
sessionIdYesThe artifact's id (its sessionId), from canvas-get_open or workspace-list_artifacts.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only say readOnly/non-destructive/not open-world; the description adds substantial context beyond that — what each action returns, what the data-ac-* attributes mean, how image assets are referenced (../../assets/<assetId>), and the significant live-page exception where html returns the page's own scripts with unsaved edits merged in. It also documents fallback behavior (screenshot defaults to selection, else first artboard) and cross-tool side effects ('canvas-replace_html swaps it').

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well structured: a one-line routing sentence ('`action` picks what to read') followed by one bullet per action, so an agent can locate the relevant action fast. It is long for a tool description, and a few parentheticals (live-page flag explanation, asset path syntax) are dense, but with eight distinct actions almost every clause carries operational information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description carries the full burden of explaining return values — and it does so per action (outline line format and flags, HTML document format, selection bounding box, asset manifest fields, page list, export formats). For a read-only tool of this complexity, an agent has everything needed to choose an action and interpret what comes back.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3; the description goes further by binding parameters to actions ('outline [rootId, depth]', 'html [id required]') and clarifying the depth default context (3 under a page, 4 under a rootId) and that id may be either a node or a page. It does not restate the scale ranges, which the schema already covers well, so it adds meaning without duplicating.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Read the canvas of an artifact... in Live Canvas') and then enumerates the eight actions the tool multiplexes, each with a concrete return description. An agent can distinguish it from canvas-replace_html / canvas-insert_html because the description explicitly frames those as the write-side counterparts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives ordering guidance ('Call this first; use the ids it returns with every other tool'), per-action when-to-use ('Use it to check your own work after edits'), and explicit routing between alternatives both within the tool ('For an image the user keeps, use canvas-read action=export_png') and across siblings ('Edit this HTML and send it back via canvas-replace_html / canvas-insert_html'). The html-vs-export_html tradeoff ('lighter read for editing' vs 'shippable deliverable') is exactly the kind of selection hint most definitions omit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.