Skip to main content
Glama

apply_edits

Apply exact text replacements or create up to 50 files in one call, pre-checking every file before writing and optionally running a verification command.

Instructions

Edit 1-50 files in one call. Per file: "hunks" (exact oldText -> newText, applied in order; CRLF/LF and BOM preserved) or "create" (+ overwrite). Default: every file is pre-checked and nothing is written unless all pass; bestEffort=true writes the valid files. Failed hunks report the closest matching line. dryRun validates only. Optional verify command (pwsh default, windowsHide) runs afterwards; a non-zero exit is returned as structured exitCode.

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>"
    },
    "name": "apply_edits"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoBase directory for relative paths and for verify (default: router cwd).
filesYes
dryRunNoValidate and report without writing (verify is skipped).
verifyNoCommand run after writing (non-interactive). Non-zero exit is reported as exitCode.
bestEffortNofalse (default): pre-check every file and write nothing if any fails. true: write every valid file, report the failed ones.
verifyShellNopwsh
maxVerifyCharsNoTail of the verify output kept inline (full output is spooled).
verifyTimeoutSecNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With only readOnlyHint=false supplied, the description carries the behavioral load and does so well: it discloses write atomicity (nothing written unless all pass), the bestEffort escape hatch, failure diagnostics ('closest matching line'), line-ending/BOM preservation, and that verify runs afterwards with non-zero exit surfaced as a structured exitCode. These are meaningful traits an agent cannot derive from the annotation.

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?

The text is dense and front-loaded with the primary action first, then per-file modes, then global flags. The telegraphic fragments ('"create" (+ overwrite)', 'dryRun validates only') are efficient but slightly cryptic on a first read, costing a point.

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

Completeness4/5

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

For an 8-parameter mutation tool with no output schema, the description covers the critical decision points and the shape of failure/verify reporting ('Failed hunks report the closest matching line', 'structured exitCode'). It does not fully sketch the returned per-file result structure, but an agent has enough to invoke it correctly.

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 63%, and the description adds real meaning beyond it: hunks apply 'in order' to current content, 'create' pairs with overwrite, dryRun also skips verify, and verify defaults to pwsh with windowsHide. It leaves some parameters (verifyTimeoutSec, maxVerifyChars, verifyShell enumeration choices) to the schema, so a 4 rather than 5.

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 opening sentence states a specific verb, resource, and scale: 'Edit 1-50 files in one call.' It immediately names the two per-file modes (hunks vs. create) so an agent knows the tool's two operating shapes without opening the schema. No sibling tool (batch_search, run_checks, tool_chain) performs file editing, so the boundary is unambiguous.

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

Usage Guidelines4/5

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

The description gives clear operational guidance for choosing modes: default is all-or-nothing pre-check, 'bestEffort=true writes the valid files', and 'dryRun validates only'. It does not name when to prefer a sibling tool or any exclusion case, so it falls short of a 5, but the guidance for in-tool alternatives is explicit.

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