Skip to main content
Glama

edit_file

Edit files by exact string find-and-replace without rewriting the whole file. Specify a unique old string and replacement text, or enable replace_all to update every match.

Instructions

Edit a file via exact string find-and-replace, without rewriting the whole file. old_str must match exactly and be unique unless replace_all is set.

Input Schema

NameRequiredDescriptionDefault
pathYes
new_strYesText to replace it with
old_strYesExact text to find
replace_allNoReplace every occurrence instead of requiring uniqueness

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.5.3

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It usefully discloses the exact-match requirement, default uniqueness, and replace_all override, but does not cover error behavior, whether the file must already exist, permissions, or mutation side effects beyond the replacement itself.

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?

The description is two sentences, front-loaded with the core mechanism and followed by the critical matching constraint. Every sentence adds useful information with no waste.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the description covers the central mechanics but leaves important context unstated, including what happens when old_str is absent or non-unique and whether the file must already exist.

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 description coverage is 75%, so the schema already explains old_str, new_str, and replace_all. The description reinforces exact matching and uniqueness semantics for old_str and replace_all, but adds little about path or failure behavior, so the baseline 3 is appropriate.

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?

The description states a specific verb and resource: exact string find-and-replace editing of a file. It also distinguishes the approach from whole-file rewriting, which implicitly contrasts with sibling write_file, though it does not name that sibling 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?

Usage is implied by 'without rewriting the whole file' and by the exact-match/uniqueness requirement, but there is no explicit when-to-use guidance or named alternative such as write_file. The replace_all condition is explained, but broader selection criteria are left to inference.

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