Edit Document
edit_documentChange part of a document you own or can edit with a batch of up to 25 precise operations, applied together as one new version: either all succeed or nothing changes. Operations: replace_text (exact text, must match exactly once unless replace_all), insert_before_heading, insert_after_heading, replace_section, delete_section, append_table_row, set_checkbox. Heading operations take a heading or path such as "Release 2.6 > M3" and work on Markdown only. For a plain find-and-replace, send edits (a list of old_text and new_text pairs) instead of operations: each old_text must appear exactly once, if_match is required, all pairs apply together or none do, and a miss returns the closest passage in the document. Send operations or edits, not both. Pass dry_run: true to see the change without saving it. Pass if_match (revision from a read) to refuse the write if the document changed; with on_conflict: "merge" the edit is combined with newer changes when they touch different sections. Pass an idempotency_key so a retry is safe. Returns a short summary of the change, never the whole document. Respects the owner's per-document AI permission. If the result lists warnings about parts of an HTML page that will not work for viewers, tell the user about them in plain words, skip any technical names, and offer to make the fix. On HTML pages, copying, moving or removing parts and fixing words by reader text are suggestions only: use suggest_document_edit.
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": {
"slug": "<slug>"
},
"name": "edit_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The slug of the document to edit | |
| edits | No | Find-and-replace pairs: each `old_text` must appear exactly once. Needs `if_match`. All pairs apply together or none do, and a miss returns the closest passage. Send this or `operations`. | |
| dry_run | No | When true, show the change without saving it. | |
| if_match | No | Revision (such as "r12") from your last read. If the document has changed since, nothing is written. | |
| operations | No | The changes to make, applied in order to one copy of the document. All succeed or none do. Send this or `edits`. | |
| on_conflict | No | When if_match is out of date: "fail" (default) writes nothing; "merge" combines the edit with newer changes if they touch different sections. | |
| idempotency_key | No | Any string up to 128 characters. A retry with the same key returns the original result instead of writing again. |