Replace HTML
canvas-replace_htmlSwap a node's subtree for new layer markup (data-ac-*, as canvas-insert_html takes it) in place — the “regenerate this element” verb. Keeps the node's id, parent, z-order and position; only the first root in the markup is used. Get the current markup with canvas-read action=html, edit it, send it back here. Returns idMap and bounds like canvas-insert_html. For the artboard of a live page, send the whole new page as plain HTML instead: the page is replaced in the same place and width as one undo step, and its artboard gets a new id (returned). Refused while the user has unsaved canvas edits on that page.
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>",
"nodeId": "<nodeId>",
"html": "<html>"
},
"name": "canvas-replace_html"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| html | Yes | Layer markup (data-ac-*), or a whole HTML page for a live page's artboard | |
| nodeId | Yes | Node to replace | |
| sessionId | Yes | The artifact's id (its sessionId), from canvas-get_open or workspace-list_artifacts. |