update_doc
Edit documents by replacing one section or the whole body with version checks to prevent overwriting concurrent changes, or append text without a read.
Instructions
Edit a document. To change ONE section, pass section= with body=<that section's new text, heading line included>: only that section is replaced and the rest of the document is kept. Without section, body is the WHOLE document — never send back the text of a single section as body (the server refuses a body that halves the document and drops its headings, unless allow_shrink=true). Replacing the body REQUIRES base_version — the version you got from get_doc — and the write is refused with a 409 if anyone changed the document since, so you can never silently overwrite someone else's edit. The append parameter adds to the end: it needs no base_version, cannot conflict, and needs no prior read of the document. The doc argument accepts an old path or a bare slug too; the reply then carries moved_to (the current path). Note the two different 409s: a stale base_version, and an ambiguous bare slug (resolved by the full path or UUID).
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": {
"doc": "<doc>"
},
"name": "update_doc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| doc | Yes | Document UUID, or a slug path like 'architecture/adr/adr-004' (a path also needs project_id). A path survives the document being moved: the old path still resolves, and so does a bare slug ('adr-004') when exactly one live document in the project has it. When the reference was not the live path, the reply carries moved_to — the document's current path; use that from now on. A bare slug shared by several documents is a 409 ('Ambiguous document slug') listing the full paths: pick one and repeat the call with the full path or the UUID. The UUID never changes. | |
| body | No | Replacement markdown for the WHOLE document, or for the one section named by section. Requires base_version. | |
| title | No | New title. | |
| append | No | Text to add to the END of the document. No base_version needed. Cannot be combined with body. | |
| section | No | Heading text or anchor of the one section to replace (as in get_doc section=). body is then that section's new text, heading line included; the rest of the document is untouched. | |
| position | No | New sort position among siblings. | |
| parent_id | No | New parent document UUID. | |
| project_id | No | Project UUID. Required only when doc is a slug path. | |
| allow_shrink | No | Only for a deliberate whole-document replacement that drops sections: lifts the guard that refuses a body halving the document. | |
| base_version | No | The version you read from get_doc. Required for any write other than append. |