Skip to main content
Glama

Edit several places in a file

files_editMany
Destructive

Change SEVERAL places in ONE file in a single call. Use this instead of calling files.edit again and again on the same file: each files.edit is another round trip that re-sends the whole conversation. The edits apply in order, all of them or none: if one snippet is missing or ambiguous the file is left untouched and the error names the edit that failed, so you fix that one and send the list again.

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": {
      "id": "<id>",
      "path": "<path>",
      "edits": "<edits>"
    },
    "name": "files_editMany"
  }
}

Input Schema

NameRequiredDescriptionDefault
idYes
pathYesREQUIRED. The one file every edit applies to, volume-root relative, e.g. '/index.js'.
editsYesApplied in order to the same file. Two edits must not touch the same text: once an edit has replaced a snippet, a later edit can no longer match it.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructive=true, readOnly=false, idempotent=false, so the safety profile is covered; the description adds real value on top by disclosing all-or-nothing atomicity, in-order application, and that the error identifies which edit failed so only that snippet must be fixed. It does not mention whether a backup/revision is created or what a successful response contains, which keeps this from a 5.

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

Conciseness5/5

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

Three tight sentences: scope first, then the sibling-routing advice, then the failure contract. Every sentence carries information and the most decision-relevant point is front-loaded.

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?

Complete enough for a batched mutation: alternatives, atomicity, ordering, the non-overlap constraint, and error recovery are all covered, and no output schema exists so return values need not be described. Only the success response shape and the meaning of the id parameter are left unaddressed.

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

Parameters3/5

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

Schema coverage is 67% and the schema already documents oldString/newString/replaceAll plus the non-overlap rule, which the description largely restates. The description adds failure semantics tied to oldString mismatches but says nothing about the undocumented id parameter. Baseline 3 is appropriate given the schema does most of the work.

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?

States a concrete verb (change), a scoped resource (SEVERAL places in ONE file), and the batching goal in a single call. It explicitly positions itself against the sibling files_edit, so an agent can distinguish the two without inspecting schemas.

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?

Gives an explicit when-to-use rule: use this instead of repeatedly calling files.edit on the same file, justified by round-trip cost. The alternative and the condition that selects it are both named, leaving nothing to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources