Skip to main content
Glama

edit_file

Replace exact strings in files to make targeted code changes without rewriting entire files. Use for precise, surgical edits.

Instructions

Edit a file by replacing an exact string with a new string. Use this for targeted code changes instead of rewriting the whole file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRelative or absolute path to the file.
new_stringYesThe replacement string.
old_stringYesThe exact string to find (case-sensitive, whitespace-sensitive).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It does not disclose what happens if old_string appears multiple times, if the file doesn't exist, if the string is not found, or whether the change is reversible/atomic. These are critical behavioral traits for a file-mutating tool.

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 concise sentences with no filler. It front-loads the main action, states the exact mechanism, and adds usage guidance. Every word earns its place.

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?

Although the schema covers parameters and an output schema exists, the description omits important edge-case behavior (multiple matches, error handling, in-place mutation semantics). For a potentially destructive file-editing tool with no annotations, this is a significant completeness gap.

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?

The schema covers all parameters with descriptions (100% coverage), including case-sensitivity and whitespace-sensitivity for old_string. The description adds minimal extra meaning beyond the schema, merely reinforcing the 'exact string' notion. Baseline of 3 is appropriate because the schema does the heavy lifting.

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 description clearly states the tool's function: 'Edit a file by replacing an exact string with a new string.' It specifies a distinct mechanism (exact string replacement) and differentiates from sibling tools like write_file by focusing on targeted changes rather than full rewrites.

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?

The description provides usage context: 'Use this for targeted code changes instead of rewriting the whole file.' This gives clear when-to-use guidance and an explicit when-not-to-use scenario, though it does not name an alternative tool explicitly, only implies the rewrite approach.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pranjal2410719/dev-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server