Skip to main content
Glama

canvas_patch

Read-only

Edit an existing json (JSON Render) canvas artifact element by element instead of resending the whole spec. Use it for every change to a json dashboard already on the canvas: name the artifact_id canvas_present returned and send only the operations that change it. Operations run in order: {"op":"set","id","element":{type, props, children?}} replaces an existing element (its children are kept when element omits them); {"op":"insert","id","parent","index"?,"element"} adds a new element under parent (appended when index is omitted); {"op":"remove","id"} deletes an element and the part of its subtree nothing else uses; {"op":"move","id","parent","index"?} re-parents an element. Keep element ids stable: reuse the ids already in the spec, add new ids only for new elements, and never rename or renumber existing ones. An element is one of canvas_present's json components with the same strict props, including binding (a dataset from list_canvas_datasets), Grid layout, LineChart annotations and Stat sparkline. time ({default, options, compare?}) and filters ([{name, label, default?}]) replace the dashboard's time control and filters and make it schema_version 2, which binding, layout, annotations and sparkline need: send time with the first patch that adds one to a v1 dashboard. To turn an inline panel live, set it with a binding; to place panels, set the Grid with its layout. The result is checked like a saved canvas (at most 128 elements and 12 levels, ids start with a letter, every child declared, no cycles); an invalid patch is refused with the exact problems and nothing changes: fix them and call once more. When the artifact is saved in the canvas library, pass base_revision_id (the revision_id your last patch returned, or current_revision_id from a refusal); if the user changed the canvas since, the call is refused with the current revision and its content to re-read. Only json artifacts can be patched: for html, svg or markdown send the complete content with canvas_present.

Input Schema

NameRequiredDescriptionDefault
timeNoReplaces the dashboard's time control, e.g. {"default":"24h","options":["1h","6h","24h","7d","30d"],"compare":false}.
titleNoA new artifact title; omit to keep the current one.
filtersNoReplaces the dashboard's filters, e.g. [{"name":"cluster","label":"Cluster"}].
operationsNoElement operations, applied in order.
artifact_idYesThe artifact_id of the json artifact to edit, as canvas_present returned it.
base_revision_idNoOnly for an artifact saved in the canvas library: the revision this patch edits (the revision_id the last patch returned, or current_revision_id from a refusal).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4/5.0
Behavior1/5

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

The annotations declare readOnlyHint=true, but the description describes an unambiguous mutation ('Edit an existing json canvas artifact', 'replaces an existing element', 'deletes an element', 're-parents an element') with server-side validation and refusals. This directly contradicts the read-only annotation and would mislead an agent about whether state is modified. Per the contradiction rule, this scores 1 despite the otherwise rich behavioral detail.

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?

The purpose and the routing to canvas_present are front-loaded, and the sentence on operations is dense but information-bearing. The block is long and unstructured (one paragraph with embedded JSON), which slightly hurts scanability, but nearly every clause earns its place given the tool's complexity.

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?

With no output schema, the description covers return/refusal behavior thoroughly: the returned revision_id, refusals carrying 'the exact problems' with nothing changing, and the current_revision_id/content on a stale base_revision_id. Constraints (128 elements, 12 levels, ids start with a letter, no cycles) and the v1→v2 time migration are all present, so an agent has what it needs to call correctly.

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 description coverage is 100%, so the baseline is 3, but the description adds substantial meaning beyond the per-field text: it explains the semantics of each op (set replaces and keeps children when omitted, insert appends when index is omitted, remove prunes unused subtree, move re-parents), the id-stability rules, and that time/filters replace the dashboard control and force schema_version 2.

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+resource+scope: 'Edit an existing json (JSON Render) canvas artifact element by element instead of resending the whole spec.' It explicitly distinguishes itself from the sibling canvas_present by contrast (patch operations vs. resending the whole spec). An agent can tell exactly what it does and how it differs from the alternative without opening the schema.

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 explicit when-to-use ('Use it for every change to a json dashboard already on the canvas') and explicit when-not with the named alternative ('Only json artifacts can be patched: for html, svg or markdown send the complete content with canvas_present'). It also names prerequisites (artifact_id from canvas_present) and the base_revision_id condition for library-saved artifacts.

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.

Resources