Skip to main content
Glama

Change several files in one commit

batch_write
Destructive

Applies 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

NameRequiredDescriptionDefault
filesYes
branchNoBranch 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.
messageYesCommit message stating the intent of the change, at most 200 characters.
projectNoProject id. Optional when the access token is scoped to exactly one project.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only flag destructive/non-idempotent/closed-world; the description adds the real behavioral core — all-or-nothing atomicity, that a stale/ambiguous anchor or user_editing cursor aborts the whole write, that errors name the offending path, and that a no-op batch answers commit:null with unchanged:true. Commit author and message-intent convention are extra context not in structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action and the sibling routing, and every sentence carries operational information. Some parenthetical load ("a person's cursor is inside that edit's quote; see edit_file") makes it dense, but nothing is filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, yet the description covers the return contract (result's commit and head, plus the commit:null/unchanged:true no-op case) and the failure modes for a 4-param destructive tool. An agent has enough to call and recover correctly without further reading.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 75%, and the description still adds meaning: files entries are either full content (new) or quote-anchored edits following edit_file rules, and message is the imperative statement of intent. branch and project semantics are left entirely to the schema, which already documents them adequately.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

"Apply one multi-file change as ONE named commit" gives a specific verb, resource, and atomicity model, and the closing sentence explicitly routes single-file work to edit_file. An agent can distinguish this from write_file/edit_file without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit when-to-use ("coherent change across files") and when-not ("use edit_file for a single file"). It also prescribes recovery behavior per error class: fix the named entry and resend the whole batch, or re-read the file and resend on version_conflict.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.