Change several files in one commit
batch_writeApplies a coherent multi-file change as one named commit, using full file content or quote-anchored edits and writing nothing if any edit fails validation.
Instructions
Apply one multi-file change as ONE named commit (author Claude). Each entry carries full content (new files) or quote-anchored edits (existing files, same rules as edit_file). All edits resolve before anything is written — a stale_anchor, ambiguous_anchor or user_editing (a person's cursor is inside that edit's quote; see edit_file) writes nothing (the error names the entry as path); fix that entry and resend the whole batch. A version_conflict on any entry also writes nothing: re-read that file and resend. Use it for a coherent change across files; use edit_file for a single file. message = the intent, imperative ("Add related-work section"). The result's commit and head are that commit; a batch that leaves every file as it was makes no commit and answers commit:null with unchanged:true (nothing is pending).
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": {
"files": "<files>",
"message": "<message>"
},
"name": "batch_write"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| files | Yes | ||
| branch | No | Branch name (defaults to 'main'). Every result, error results included, echoes {branch, head} — head is the branch's current commit (after a write, the commit that write made). Pass the branch explicitly whenever you are not on main. | |
| message | Yes | Commit message stating the intent of the change, at most 200 characters. | |
| project | No | Project id. Optional when the access token is scoped to exactly one project. |