<!-- enhance-docs page=reference/mcp/canvas-edit -->
<!-- enhance-docs release-sha256=8a804cfc9a6fc6b942b8daf6a82266ad6e308291ae4351abee3346bc696d1258 -->

# canvas.edit

<span class="reference-badge">mutation</span> <span class="reference-badge">write</span>

Use when the requested change exactly matches canvas.edit; read the current state first when a version or identifier may have changed.

## Before calling

- Authenticate as the accountable Enhance person.
- Use only resource identifiers returned by an earlier capability result or supplied by the person.
- Reuse clientToken only when retrying this exact mutation input.

## Input

<details class="reference-schema">
<summary>Show complete JSON Schema</summary>

```json
{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"canvas":{"type":"string","minLength":1,"description":"Canvas UUID or full canvas/selection URL; selection limits the entire edit batch."},"baseVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991,"description":"Exact version to edit, including the version returned by a previous successful write."},"edits":{"minItems":1,"type":"array","items":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"set_text"},"nodeId":{"type":"string","minLength":1},"text":{"type":"string"}},"required":["kind","nodeId","text"]},{"type":"object","properties":{"kind":{"type":"string","const":"set_styles"},"nodeIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"styles":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"null"}]}}},"required":["kind","nodeIds","styles"]},{"type":"object","properties":{"kind":{"type":"string","const":"rename"},"nodeId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1}},"required":["kind","nodeId","name"]},{"type":"object","properties":{"kind":{"type":"string","const":"duplicate"},"nodeIds":{"minItems":1,"type":"array","items":{"type":"string","minLength":1}},"parentId":{"type":"string","minLength":1}},"required":["kind","nodeIds"]},{"type":"object","properties":{"kind":{"type":"string","const":"move"},"nodeId":{"type":"string","minLength":1},"destination":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"before"},"nodeId":{"type":"string","minLength":1}},"required":["kind","nodeId"]},{"type":"object","properties":{"kind":{"type":"string","const":"after"},"nodeId":{"type":"string","minLength":1}},"required":["kind","nodeId"]},{"type":"object","properties":{"kind":{"type":"string","const":"parent"},"parentId":{"type":"string","minLength":1},"index":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["kind","parentId"]}]}},"required":["kind","nodeId","destination"]}]},"description":"Sequential text, style, rename, duplicate or move edits, committed atomically. Target existing node IDs."}},"required":["canvas","baseVersion","edits"]}
```
</details>

### Example

<details class="reference-schema">
<summary>Show example input</summary>

```json
{
 "canvas": "00000000-0000-4000-8000-000000000010",
 "baseVersion": 1,
 "edits": [
  {
   "kind": "set_text",
   "nodeId": "text_title",
   "text": "Today"
  }
 ]
}
```
</details>

## Result

Returns a typed canvas.edit result from the Enhance API without transport-specific prose.

- `canvasId` (required): Returned field canvasId.
- `mutationId` (required): Returned field mutationId.
- `previousVersion` (required): Returned field previousVersion.
- `version` (required): Returned field version.
- `operations` (required): Returned field operations.
- `insertedNodeIds` (required): Returned field insertedNodeIds.
- `changedNodeIds` (required): Returned field changedNodeIds.
- `removedNodeIds` (required): Returned field removedNodeIds.
- `boxes` (required): Returned field boxes.
- `affectedBounds` (required): Returned field affectedBounds.
- `copiedNodeIds`: Returned field copiedNodeIds.
- `next` (required): Returned field next.

[Show complete result JSON Schema (JSON file)](/docs/reference/mcp/canvas-edit.output-schema.json)

### Example result

<details class="reference-schema">
<summary>Show example result</summary>

```json
{
 "canvasId": "00000000-0000-4000-8000-000000000010",
 "mutationId": "00000000-0000-4000-8000-000000000010",
 "previousVersion": 1,
 "version": 2,
 "operations": [
  {
   "op": "setText",
   "nodeId": "text_title",
   "text": "Today"
  }
 ],
 "insertedNodeIds": [],
 "changedNodeIds": [
  "text_title"
 ],
 "removedNodeIds": [],
 "boxes": {},
 "affectedBounds": null,
 "next": []
}
```
</details>

## Recovery

- BAD_REQUEST: correct the named fields and call again.
- UNAUTHORIZED: restore Enhance authentication, then retry once.
- FORBIDDEN or NOT_FOUND: check the supplied resource and selection; do not substitute unrelated content. Ask for corrected access or scope if needed.
- CONFLICT: read the current resource, merge the intended change, and retry with its version.
- INTERNAL: run Enhance diagnostics, report the failure, and stop repeating the call.

## Continue with

- Reuse the committed version for the next edit. Render the affected screen when the requested visual change is ready to review.

## Versions

Compatibility: `72e27eb6b0061e67d7277da33639e8ae78aa850e11f9264ea17a31e2d5ac8e53`.

Minimum tested versions: Enhance CLI and MCP runtime 0.1.40, plugin 1.0.38, Node.js 24. No older floor is published.
