Skip to main content
Glama

Edit file

edit_file
Destructive

Replace exact text fragments in a file without rewriting it. Apply one or more edits atomically; ambiguous matches are refused, and dry-run preview plus SHA-256 checks enable safe concurrent editing.

Instructions

Replace exact text fragments in a file instead of rewriting the whole file. One edit: oldString/newString. Several edits in one atomic change: edits=[{oldString,newString,replaceAll?}] — applied in order, all or nothing. Refuses an edit whose oldString is not found or found more than once (unless replaceAll), so it can never patch the wrong place. Supports expectedSha256 (safe concurrent editing) and dryRun preview; the previous version is kept in ZeroIDE history for undo. Write is atomic.

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": {
      "path": "<path>"
    },
    "name": "edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoShort human-readable explanation (1 line, in the user's language) of what you are about to do and why. Shown to the user on the approval card. Always provide when calling mutating tools.
pathYes
agentNoShort consistent identifier or display name of this agent (e.g. 'Claude · Лендинг', 'Тесты', 'Мой агент'). Used to separate tasks and route tray messages when multiple agents work in parallel.
editsNoSeveral replacements applied in order as one atomic change. Use instead of oldString/newString.
backupNo
dryRunNo
newStringNo
oldStringNo
requestIdNo
replaceAllNoSingle-edit mode: replace every occurrence of oldString instead of requiring exactly one.
expectedSha256No

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnly=false, destructive=true), it discloses the traits that actually matter for a mutating editor: all-or-nothing atomic application, refusal when oldString is missing or ambiguous, expectedSha256 for concurrent-edit safety, dryRun preview, and undo via ZeroIDE history. That is exactly the behavioral context an agent needs before overwriting user content.

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?

Purpose is front-loaded in the first clause and every subsequent sentence adds a distinct fact (mode selection, atomicity, refusal rule, safety options). It is dense with semicolon-chained clauses, which slightly reduces scannability but wastes no words.

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?

For a destructive 11-parameter mutation tool with no output schema, it covers the essentials: how edits are applied, failure modes, concurrency safety, preview, and recoverability. The only omissions (backup, requestId) are peripheral to calling the tool 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?

With only 36% schema description coverage across 11 parameters, the description carries real weight: it explains the semantics of oldString/newString, the edits array shape and ordering, replaceAll, expectedSha256, and dryRun. Gaps remain for backup and requestId, which are undocumented in both schema and description.

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 names a specific verb and resource ('Replace exact text fragments in a file') and immediately contrasts the scope with the sibling pattern of rewriting whole files ('instead of rewriting the whole file'), so an agent can tell it apart from write_file without opening a schema.

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?

It clearly routes between the two invocation modes ('One edit: oldString/newString. Several edits in one atomic change: edits=[...] — Use instead of oldString/newString' in the schema), giving concrete selection criteria. It does not, however, explicitly say when to prefer write_file or file_ops over this tool, so the broader when-not guidance is only implied.

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