Skip to main content
Glama

edit_file

Perform precise search-and-replace in existing UTF-8 files, ensuring the old string matches exactly once, or replace all occurrences with a single operation.

Instructions

Search-and-replace in an existing UTF-8 file: old_string must be non-empty and match exactly once unless replace_all is true. Read the file first and copy the exact span. Output uses newline='\n' like write_file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
new_stringYes
old_stringYes
replace_allNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

With no annotations, the description carries full burden. It discloses UTF-8 handling, newline convention, and match constraints (exact, unique unless replace_all). However, it omits permissions, error handling, and whether the file is created if missing.

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?

Two sentences with no redundancy. Every word is informative. Front-loaded with the core operation and key constraints.

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?

Given an output schema exists, the description covers operation, constraints, and a usage hint. It mentions UTF-8 and newline convention. Could add error handling or file existence requirement, but overall adequate for a well-defined edit tool.

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 has 0% description coverage, so the description compensates partially. It explains old_string (non-empty, exact match) and replace_all (changes behavior). Path and new_string are implied but not detailed. Adds moderate value beyond names.

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 it performs search-and-replace on an existing UTF-8 file, which distinguishes it from siblings like read_file, write_file, and run_command. It specifies the action and resource concisely.

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 explicit guidance: 'Read the file first and copy the exact span.' It also clarifies conditions (old_string must match exactly once unless replace_all is true). However, it does not explicitly contrast with write_file for full rewrites.

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/mdvohra/agent-godmode'

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