Skip to main content
Glama

edit

Modify files via exact replacement, find/replace, or line-range modifications. Supports preview, auto-format, and explicit diff output.

Instructions

Edit one file via exact replacement.

For multiple edits to the same file, use batch_edit (single response, atomic, faster). For full rewrites, use write.

Modes: find/replace (old_string+new_string), scoped (add start_line/end_line), or line-range (omit old_string, provide both lines). Keep old_string short and unique; add line bounds when ambiguous.

Args: path: File path to modify. old_string: Exact text to find. Omit only for line-range replacement. new_string: Replacement text. replace_all: Replace all matches instead of requiring uniqueness. dry_run: Preview without writing. auto_format: Run formatter after editing. show_diff: Return the diff explicitly for successful deterministic edits. start_line: 1-based inclusive start line for scoped or line-range edit. end_line: 1-based inclusive end line for scoped or line-range edit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
old_stringNo
new_stringNo
replace_allNo
dry_runNo
auto_formatNo
show_diffNo
start_lineNo
end_lineNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
truncatedNo
statusNo
pathNo
replacedNo
line_numbersNo
diffNo
diff_stateNo
diff_omittedNo
tokens_savedNo
diff_statsNo
content_hashNo
from_cacheNo
paramsNo
Behavior4/5

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

No annotations are provided, so the description carries full burden. It discloses the exact replacement behavior, effects of parameters like replace_all, dry_run, auto_format, show_diff, and the scoping modes. While it doesn't explicitly state that editing is destructive, the purpose 'edit' implies mutation, and the description covers behavioral traits adequately.

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?

The description is well-structured with a summary line, then usage guidelines, then parameter explanations. It is front-loaded with the main purpose. Though somewhat lengthy, each sentence provides useful information with minimal redundancy.

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

Completeness5/5

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

Given the complexity (9 parameters, 1 required, no schema descriptions, but output schema exists), the description is complete. It covers all modes, parameter semantics, sibling differentiation, and behavioral aspects, enabling an AI agent to correctly select and invoke the tool.

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

Parameters5/5

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

Schema coverage is 0% (no parameter descriptions in schema), so the description must compensate. It explains the purpose and use of all 9 parameters: path, old_string, new_string, replace_all, dry_run, auto_format, show_diff, start_line, end_line. It clarifies optional conditions and defaults, adding significant value beyond the schema.

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 'Edit one file via exact replacement' and explicitly distinguishes from siblings: 'For multiple edits to the same file, use batch_edit' and 'For full rewrites, use write'. It provides specific verb and resource, and differentiates modes within the tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit guidance on when to use this tool vs alternatives (batch_edit, write). It also advises on best practices like keeping old_string short and adding line bounds when ambiguous, and explains the three modes of operation with conditions.

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/CoderDayton/semantic-cache-mcp'

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