<!-- enhance-docs page=reference/mcp/canvas-edit -->
<!-- enhance-docs release-sha256=7ff3d88e90f9dd4fa5ee87960f993597885d25e92abc5665bd2ecbc70cd6621b -->

# 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,
   "maxItems": 100,
   "type": "array",
   "items": {
    "oneOf": [
     {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "const": "set_text"
       },
       "nodeId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
       },
       "text": {
        "type": "string",
        "maxLength": 100000
       }
      },
      "required": [
       "kind",
       "nodeId",
       "text"
      ],
      "additionalProperties": false
     },
     {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "const": "set_styles"
       },
       "nodeIds": {
        "minItems": 1,
        "maxItems": 1000,
        "type": "array",
        "items": {
         "type": "string",
         "minLength": 1,
         "maxLength": 200
        }
       },
       "styles": {
        "type": "object",
        "propertyNames": {
         "type": "string"
        },
        "additionalProperties": {
         "anyOf": [
          {
           "type": "string"
          },
          {
           "type": "number"
          },
          {
           "type": "null"
          }
         ]
        }
       }
      },
      "required": [
       "kind",
       "nodeIds",
       "styles"
      ],
      "additionalProperties": false
     },
     {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "const": "rename"
       },
       "nodeId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
       },
       "name": {
        "type": "string",
        "minLength": 1,
        "maxLength": 500
       }
      },
      "required": [
       "kind",
       "nodeId",
       "name"
      ],
      "additionalProperties": false
     },
     {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "const": "duplicate"
       },
       "nodeIds": {
        "minItems": 1,
        "maxItems": 1000,
        "type": "array",
        "items": {
         "type": "string",
         "minLength": 1,
         "maxLength": 200
        }
       },
       "parentId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
       }
      },
      "required": [
       "kind",
       "nodeIds"
      ],
      "additionalProperties": false
     },
     {
      "type": "object",
      "properties": {
       "kind": {
        "type": "string",
        "const": "move"
       },
       "nodeId": {
        "type": "string",
        "minLength": 1,
        "maxLength": 200
       },
       "destination": {
        "oneOf": [
         {
          "type": "object",
          "properties": {
           "kind": {
            "type": "string",
            "const": "before"
           },
           "nodeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
           }
          },
          "required": [
           "kind",
           "nodeId"
          ],
          "additionalProperties": false
         },
         {
          "type": "object",
          "properties": {
           "kind": {
            "type": "string",
            "const": "after"
           },
           "nodeId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
           }
          },
          "required": [
           "kind",
           "nodeId"
          ],
          "additionalProperties": false
         },
         {
          "type": "object",
          "properties": {
           "kind": {
            "type": "string",
            "const": "parent"
           },
           "parentId": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
           },
           "index": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991
           }
          },
          "required": [
           "kind",
           "parentId"
          ],
          "additionalProperties": false
         }
        ]
       }
      },
      "required": [
       "kind",
       "nodeId",
       "destination"
      ],
      "additionalProperties": false
     }
    ]
   },
   "description": "One to 100 sequential text, style, rename, duplicate or move edits, committed atomically. Target existing node IDs."
  }
 },
 "required": [
  "canvas",
  "baseVersion",
  "edits"
 ],
 "additionalProperties": false
}
```
</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.

## 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.

Compatibility: `d13c052a1275bc965e9eb438ff03d0951c2caed922c9f587da784ac7bad94998`.
