akb_edit
Replace exact text in a single document. Supports unique or multiple occurrences and concurrent edit detection.
Instructions
Edit a single document by replacing exact text. Scope is one document. old_string must be unique within the document (or use replace_all). If old_string is not found or appears multiple times, the call fails with a clear error. For find-and-replace across many documents, use akb_grep with replace instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | Yes | Document URI | |
| old_string | Yes | Exact text to replace. Must be unique in the document body unless replace_all=true. Include surrounding context if needed for uniqueness. | |
| new_string | Yes | Replacement text. Can be empty to delete. | |
| replace_all | No | Replace all occurrences (default: false, requires old_string to be unique) | |
| message | No | Commit message describing the change | |
| base_commit | No | Optional OCC pin — when set, the edit is rejected if the document's current_commit moved. Use after akb_get to fail-fast on concurrent writers. |