edit_doc
Edit an existing Markdown or HTML document with a precise text replacement or a full rewrite, using a base version to prevent overwriting concurrent changes. Returns the diff and new version.
Instructions
Edit an existing document (.md or .html), one of two ways. old_string + new_string replace text found exactly once (add context to make it unique; the error shows the closest passage, or each occurrence): preferred, cheap on big docs. Or content rewrites the whole file. Pass the version read_doc gave as base_version, so a change made in between is never overwritten. Committed at once, attributed to you. Returns the diff and the new version, and how the quotations it added stand against the mind's files; dry_run=true shows the diff without writing. To rename, use move_doc; to restore a past version, doc_revert.
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": {
"path": "<path>",
"ai": "<ai>"
},
"name": "edit_doc"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ai | Yes | Your AI family in lowercase (claude, chatgpt, gemini), not the model name. Attributes the change. | |
| path | Yes | e.g. notes/recap.md. | |
| content | No | The full new content (rewrite mode). | |
| dry_run | No | Return the diff; write nothing. | |
| new_string | No | Its replacement. | |
| old_string | No | The exact text to replace, unique in the doc. | |
| base_version | No | read_doc's `version`: the edit is refused if the doc changed since. Without it, a `content` rewrite replaces the doc as it stands when it lands. | |
| commit_message | No | What changed and why, specifically (e.g. 'fix the VAT rate'); omit it rather than write 'update doc'. |