Skip to main content
Glama

Edit File

edit_file

Replace exact text in a file, refusing ambiguous matches unless replace_all is enabled. Use dry_run to preview changes before writing.

Instructions

Replace exact text in a file; refuses ambiguous matches unless replace_all is enabled.

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>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "edit_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
dry_runNo
new_textYes
old_textYes
replace_allNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.1

TDQS

B3.1/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It usefully discloses one real behavioral trait — ambiguous matches are refused unless replace_all is enabled — but says nothing about what happens when old_text is not found, atomicity, permissions, or encoding handling.

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?

A single, front-loaded sentence with zero wasted words. Its brevity is efficient structurally, though it borders on under-specification for a five-parameter mutation tool.

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

Completeness2/5

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

For a write tool with no annotations, no output schema, and 0% schema coverage on five parameters, the definition covers only the ambiguity rule. dry_run — clearly a safety-relevant preview flag — is left completely unexplained, as is failure behavior.

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

Parameters2/5

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

Schema description coverage is 0% across five parameters, so the description must compensate and it only explains one: replace_all. It adds nothing about dry_run semantics, the uniqueness requirement on old_text, or how new_text interacts with whitespace.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: "Replace exact text in a file." The exact-match semantics meaningfully distinguish it from siblings like write_file and apply_patch, though it never names those alternatives explicitly.

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?

Implies the use case (surgical text replacement in an existing file) and notes the ambiguity-refusal behavior, but gives no explicit guidance on when to choose this over write_file, apply_patch, or read_file first.

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