Skip to main content
Glama
office233
by office233

edit_file

Destructive

Replace exact text in a single file using one or multiple atomic edits applied in order, then run linters and return diagnostics plus a checkpoint ID.

Instructions

Replace exact text in one file. Either oldText/newText, or edits: [{oldText,newText,replaceAll}] applied atomically in order. oldText must match exactly once unless replaceAll. Reports diagnostics and a checkpoint id.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path
checkNoRun compilers/linters on the changed files afterwards (default true)
editsNo
newTextNo
oldTextNo
replaceAllNo
expectedSha256NoOptional optimistic precondition from file_info; refuse the edit if the file changed

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.1

TDQS

A4.2/5.0
Behavior4/5

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

Adds substantial context beyond the annotations: unique-match semantics for oldText, replaceAll override, atomic in-order application of edits, and reporting of diagnostics plus a checkpoint id. Annotations cover destructive/idempotent flags; the description enriches with matching and atomicity rules the annotations do not convey.

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 compact sentences, front-loaded with the core action, then input modes, then matching/atomicity rules, then return info. Every clause carries information; no filler.

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 a destructive mutation with no output schema, the description gives matching rules, atomicity, diagnostics, and checkpoint id – the essentials an agent needs. It omits how to recover via checkpoint_rewind and leaves expectedSha256 unexplained, so it stops short of fully complete.

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 description coverage is only 43%, and the description compensates by explaining the exact-match requirement (once unless replaceAll), the dual mode (oldText/newText or edits array), and atomic sequencing. It leaves path, check, and expectedSha256 without added meaning, but covers the highest-risk parameters well.

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 specific verb (Replace) and resource (exact text in one file), and distinguishes itself from write_file and apply_patch by restricting to exact-text replacement. An agent can tell this apart from its sibling editing tools immediately.

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

Usage Guidelines3/5

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

The description explains the two mutually exclusive input modes (oldText/newText vs edits array), which is usage-relevant, but never states when to prefer this over write_file or apply_patch. No explicit when-to-use reasoning is given.

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

Deploy Server

Other Tools