Canvas patch
canvas_patchEdit 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. To read or change a dashboard saved in the canvas library that is not an artifact of this conversation (the user names it by its canvas id), send canvas_id instead of artifact_id: with no base_revision_id the call changes nothing and answers the dashboard's current_revision_id and current_content; then patch it with canvas_id, base_revision_id set to current_revision_id and only the operations that change it. A dashboard the user may only read is answered canvas_read_only and one they cannot open canvas_not_found: tell them so, and never present a new dashboard in its place unless they ask for one.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "canvas_patch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| time | No | Replaces the dashboard's time control, e.g. {"default":"24h","options":["1h","6h","24h","7d","30d"],"compare":false}. | |
| title | No | A new artifact title; omit to keep the current one. | |
| filters | No | Replaces the dashboard's filters, e.g. [{"name":"cluster","label":"Cluster"}]. | |
| canvas_id | No | The id of a dashboard saved in the canvas library, to read or change it when it is not an artifact of this conversation. Send this or artifact_id, not both. | |
| operations | No | Element operations, applied in order. | |
| artifact_id | No | The artifact_id of the json artifact to edit, as canvas_present returned it. Send this or canvas_id, not both. | |
| base_revision_id | No | Only 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). |