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; in audio and video also {at_ms: n}, what plays at that moment as the ops before it left it: an audio region, a video's clip), {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, and adjusted names any number that was set to another value than asked (a time snapped to a zero crossing or a frame, a value held to its limits: asked, set). 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 library's current item). |
path | string | no | Or its path or name. A .md or .txt anywhere on disk too, by its full path: outside the library the user is asked once to let you into its folder. |
create | boolean | no | Make a new .md or .txt at path (which mustn't exist) from the ops, e.g. [{op: set, target: document, props: {text: "# Title"}}]. Plain text: no SuperCapture header is added. |
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. |
revision | string | no | A Markdown or text document: the revision your doc_read gave (each doc_edit's result gives the next). The batch is refused as conflict, nothing applied, if the document changed since, the user's typing included. |
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. |
task | string | no | What you are doing, in a few words the user will read, e.g. "tighten the pauses". Every doc_edit with the same task becomes ONE undo step, "Agent: tighten the pauses", and one entry in the activity log: keep the name for every call of the task and change it when the next task starts. An edit of the user's, an undo, or ten idle minutes closes the step, and the next call starts a new one. Without a task, your edits share one step, "Agent edits". Up to 80 characters. |
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.