doc_edit
DocumentsFull
Change a document: a batch of operations applied as one undo step, all or nothing. Each op is one of {op: add, kind, props, ref?, parent?} (ref names it '$x' for later ops), {op: set, target, props} (target: an element id, a $ref or a section name), {op: delete, target}, {op: order, target, to: front|back|forward|backward|index}, or {op: do, action, target?, ref?, ...args} (ref names what an action makes, e.g. a duplicate's copy). Open in its editor, the edit shows at once and is undoable there; closed, it is saved as Save & Exit saves. The result lists created ids (an action's too) and every touched element as doc_read returns it. describe lists the kinds, properties and actions.
Needs the Full level, which is the default for any client holding the bearer token.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id | string | no | The item's id (default: the item open in an editor, else the gallery's current item). |
path | string | no | Or its path or name. |
page | integer | no | A multi-page image's page (1 is the first; default the one on screen). A batch edits one page. |
ops | object[] | yes | The operations, in order. |
coords | string one of "doc", "render" | no | doc (default): the picture's own pixels (a video item's: the recording's, or the canvas's for a canvas item). render: the pixels of your last doc_render of this document, as you saw it. |
Example
A JSON-RPC call to POST http://localhost:21516/mcp with the bearer token, filling in the required parameters:
{ "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "doc_edit", "arguments": { "ops": [] } }}See the MCP server overview for how to connect a client and where the token lives.