Skip to main content
Glama

Replace HTML

canvas-replace_html
Destructive

Swap 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

NameRequiredDescriptionDefault
htmlYesLayer markup (data-ac-*), or a whole HTML page for a live page's artboard
nodeIdYesNode to replace
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 already declare destructiveHint=true and openWorldHint=true, but the description adds substantial behavior beyond that: node id, parent, z-order and position are preserved; only the first root in the markup is used; the live-page path consumes one undo step and returns a new artboard id; and the call is refused during unsaved edits. These are non-obvious, consequence-defining details for a destructive mutation.

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?

Front-loaded with the core action and the differentiator, then moves to workflow, then edge cases. Dense but purposeful; a couple of parentheticals ("as canvas-insert_html takes it") and em-dash asides add slight syntactic load without losing the reader.

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?

For a destructive, no-output-schema mutation, the description covers the input forms, identity/ordering guarantees, return values (idMap and bounds, new artboard id), and the refusal condition. There is no output schema, and the description compensates by describing 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, but the description adds meaning the schema does not: "replace" does not destroy the node identity (id, parent, z-order, position kept) and only the first root in `html` is honored. It also clarifies that `html` may hold either layer markup or an entire page depending on the target, which disambiguates the dual use of a single string parameter.

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: swaps a node's subtree for new layer markup, framed as the "regenerate this element" verb. It explicitly contrasts with canvas-insert_html (same markup format) and canvas-read (how to get current markup), so an agent can tell it apart from siblings without opening a 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 an explicit workflow (read html with canvas-read action=html, edit it, send it back here) and an explicit alternative route: for a live page's artboard, send the whole new page as plain HTML instead. It also states a blocking precondition (refused while the user has unsaved canvas edits on that page), which is exactly the kind of when-not guidance that prevents failed calls.

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.