Write batch (commits changes)
write_batchApplies multiple typed wiki edits (create, overwrite, replace, delete, rename) in one validated git commit, ensuring planned changes either fully succeed or leave the wiki unchanged.
Instructions
Transactionally apply typed edit operations in one git commit.
Call it only after the user agreed to the plan (target wiki, every operation, any split into several batches). Keep each call under about 30 kB of arguments: split up front, with index and log in the last batch.
Each edit is one {op, ...}, applied in order (chained on the same path):
create: {op, path, content}; fails if the path exists.
overwrite: {op, path, content, expected_version}; full rewrite.
replace: {op, path, old, new, expected_version, replace_all?}; surgical edit, 'old' must be unique unless replace_all=true. Read the page with raw=True first so 'old' matches the bytes on disk.
delete: {op, path, expected_version}.
rename: {op, path, new_path, expected_version}; wikilinks to the old name are not rewritten, fix them with replace ops in the same batch.
expected_version is the token from read_page; required to modify, delete or rename an existing file, ignored for a path created earlier in this batch. Writes stay under the wiki and raw zones or the index/log/schema files; raw/ is create-only; the log, index and schema cannot be deleted or renamed. Everything is validated first: on any failure nothing is written or committed. Returns {commit, applied}.
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": {
"wiki": "<wiki>",
"edits": "<edits>",
"message": "<message>"
},
"name": "write_batch"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wiki | Yes | Wiki id, as returned by list_wikis. | |
| edits | Yes | Edit operations, applied in order; see the tool description. | |
| message | Yes | Commit message describing the change. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||