Skip to main content
Glama
duplonicus
by duplonicus

edit_file

Destructive

Replace exact text in a file within a WSL distribution, requiring a unique old string unless replace_all is true.

Instructions

Replace exact text in a file. old_string must appear exactly once unless replace_all is true.

path: the file to change. old_string: the exact text to find (copied from read_file output, without line numbers). new_string: the text to put in its place. replace_all: replace every occurrence instead of requiring a single one.

Input Schema

NameRequiredDescriptionDefault
pathYes
new_stringYes
old_stringYes
replace_allNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, so the safety profile is covered. The description adds the non-obvious failure precondition that old_string must occur exactly once unless replace_all is true, which is real behavioral value beyond the annotations. It stops short of describing what happens on no-match/multi-match failure.

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?

Front-loads the core behavior and the critical uniqueness rule in the first sentence, then uses four tight lines to define parameters. No filler or redundancy.

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?

An output schema exists, so return values need not be explained, and the description covers the main error condition. Remaining gaps are minor: path format (relative vs absolute), behavior when old_string is absent, and the read-before-edit requirement are left implicit.

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?

Schema description coverage is 0%, so the description carries the full burden, and it defines all four parameters in prose. The 'without line numbers' detail for old_string is genuinely clarifying, though 'path: the file to change' adds little beyond the parameter name.

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 ('Replace exact text in a file') and the exact-match semantics imply it is a surgical edit rather than a full rewrite, which separates it from write_file. However, it never names or contrasts with its closest sibling write_file explicitly, so an agent must infer the boundary.

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 parenthetical '(copied from read_file output, without line numbers)' implies a read-then-edit workflow, which is useful. But there is no explicit when-to-use-this vs write_file guidance and no statement of preconditions such as the file needing to exist or have been read first.

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