Skip to main content
Glama

batch_edit

Apply multiple exact edits to one file in a single, atomic call. Supports full-file, scoped, and line-range replacements with partial success handling.

Instructions

Apply multiple exact edits to one file in a single call.

Preferred over repeated edit calls on the same file: single response, atomic across all edits, and faster on large files. For cross-file work, call the relevant tools per file instead of trying to batch across files.

Supported entry forms:

  • [old, new] for full-file exact replacement

  • [old, new, start_line, end_line] for scoped replacement

  • [null, new, start_line, end_line] for line-range replacement

  • {"old": ..., "new": ..., "start_line": ..., "end_line": ...}

Behavior:

  • Partial success is allowed.

  • Failed edits are returned so you can retry only the misses.

  • Prefer line-range entries when you already have line numbers from read.

  • Deterministic all-success batches omit full diffs unless show_diff=true or debug mode is enabled.

Args: path: File path to modify. edits: JSON array of edit entries for that file. dry_run: Preview without writing. auto_format: Run formatter after edits. show_diff: Return the diff explicitly for successful deterministic batches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
editsYes
dry_runNo
auto_formatNo
show_diffNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
truncatedNo
statusNo
pathNo
succeededNo
failedNo
failuresNo
diffNo
diff_stateNo
diff_omittedNo
tokens_savedNo
outcomesNo
diff_statsNo
content_hashNo
from_cacheNo
paramsNo
Behavior5/5

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

No annotations, so description carries full burden. It discloses partial success allowed, failed edits returned, deterministic all-success batches omit diffs unless show_diff=true, and supported entry forms. Thorough behavioral context.

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?

Well-organized with sections for supported entry forms, behavior, and args. Front-loaded with purpose and differentiation. Slightly lengthy but efficient.

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?

Given 5 parameters, 0% schema coverage, no annotations, but output schema exists, the description is highly complete. Covers behavior, args, entry forms, and usage guidelines effectively.

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

Parameters5/5

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

Schema description coverage is 0%, but description has a dedicated 'Args:' section explaining each of the 5 parameters (path, edits, dry_run, auto_format, show_diff) beyond the schema.

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?

The description clearly states the tool applies multiple exact edits to one file in a single call. It distinguishes from sibling `edit` by noting it's preferred for same-file edits, and mentions cross-file work should use other tools.

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?

Explicitly says 'Preferred over repeated `edit` calls on the same file' with reasons. Also provides clear guidance: 'For cross-file work, call the relevant tools per file instead of trying to batch across files.'

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/CoderDayton/semantic-cache-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server