Skip to main content
Glama

edit_file

Replace specific text in files to make targeted edits without rewriting the whole file.

Instructions

Performs a precise surgical search-and-replace edit in an existing file. Avoids having to rewrite the entire file when making targeted code changes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNo
file_pathYes
find_textYes
replace_textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.8/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure, and it only says the edit is 'surgical search-and-replace.' It doesn't disclose failure modes (what happens if find_text isn't found or matches multiple locations), whether edits are in-place, or any safety caveats for a mutating operation. This is a significant gap for a destructive tool.

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?

Two sentences with the primary purpose front-loaded. The word 'surgical' adds little information, but overall the description is tight and wastes no words. It could afford to carry more useful content, but what's there is efficiently structured.

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?

An output schema exists, so return values need not be explained. But for a mutating tool with 0% parameter coverage, no annotations, and an undocumented 'source' parameter, the description is incomplete: it leaves match behavior, failure handling, and the extra parameter unexplained. An agent cannot fully predict tool behavior from this definition.

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

Parameters1/5

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

Schema description coverage is 0%, so the description must compensate, but it mentions nothing about file_path, find_text, replace_text, or the unexplained 'source' parameter (anyOf string/null with default null). The three required params are somewhat self-explanatory by name, but the odd 'source' field is completely undocumented, and no syntax/format guidance is given for the find/replace strings.

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+resource: a surgical search-and-replace edit on an existing file. It implicitly differentiates from file-rewriting siblings (write_file, append_file) by noting it avoids rewriting the entire file, though it never names a sibling explicitly. Clear enough for an agent to understand the core operation.

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 phrase 'Avoids having to rewrite the entire file when making targeted code changes' implies this tool is for targeted edits rather than full-file rewrites, which hints at when to prefer it over write_file. However, it never names alternatives explicitly, states when NOT to use it, or covers edge cases like multiple matches or non-existent files.

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