Skip to main content
Glama

Edit File

edit
Destructive

Replace exact literal strings in files sequentially. Target first occurrence per edit using oldText context. Preview with dryRun to verify changes before writing.

Instructions

Apply sequential literal string replacements to a file (first occurrence per edit). oldText must match exactly — include 3–5 lines of context for unique targeting. Use dryRun:true to preview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to file or directory.
editsYesList of replacements to apply sequentially. Each edit replaces the first occurrence of oldText.
dryRunNoPreview edits without writing. Check `unmatchedEdits` in response.
ignoreWhitespaceNoTreat all whitespace sequences as equivalent when matching oldText.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
pathNo
appliedEditsNo
linesAddedNoLines added
linesRemovedNoLines removed
lineRangeNoLine range modified [start, end] (1-based)
unmatchedEditsNoEdits that could not be applied
diffNoUnified diff of changes (dryRun)
Behavior4/5

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

Annotations already indicate destructive and non-idempotent behavior. The description adds behavioral details: sequential application, first occurrence matching, and preview via dryRun. These go beyond what annotations provide, giving the agent a clear picture of the tool's operation.

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 concise with two sentences, no extraneous text. It front-loads the core operation and provides essential guidance, making it efficient for the agent to parse.

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 the presence of an output schema (not shown), return values need not be explained. The 4 parameters are covered in the description and schema. The description could mention the ignoreWhitespace parameter, but it's not critical. Overall, it provides sufficient context for the tool's use.

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

Parameters4/5

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

With 100% schema coverage, the baseline is 3. The description adds value by emphasizing exact matching and context for oldText, and highlighting dryRun for preview. This contextual nuance helps the agent use parameters effectively.

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 clearly states it applies sequential literal string replacements to a file, limited to first occurrence per edit. It specifies that oldText must match exactly with context. However, it does not explicitly differentiate this tool from siblings like 'apply_patch' or 'search_and_replace', which might offer similar functionality.

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 description provides usage tips such as requiring exact matching, including 3-5 lines of context, and using dryRun for preview. However, it does not give guidance on when to use this tool versus alternatives (e.g., for simple replacements vs. patching), nor does it state when not to use it.

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/j0hanz/filesystem-mcp'

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