Skip to main content
Glama

Edit file

edit_block
Destructive

Use this when one known text block in one file should be replaced, with a whitespace-tolerant fallback and optional dry-run diff. Use write_file only when replacing the whole file, and replace_lines when the intended target is a known line range rather than matching text.

Input Schema

NameRequiredDescriptionDefault
deviceYesReMCP device id returned by list_devices. Required for every device operation.
dry_runNoReturn the diff without changing the file. Default false.
file_pathYesAbsolute path of the file to edit.
new_stringYesReplacement text.
old_stringYesExact existing text to replace.
allow_fuzzyNoAllow a whitespace-tolerant fallback when the exact text is not found. Default true.
expected_replacementsNoNumber of matches required for the edit to apply. Default 1.

Output Schema

NameRequiredDescriptionDefault
dataNoOptional structured result data for follow-up reasoning and tool calls.
textYesConcise human-readable result of the tool call.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations declare destructiveHint=true, which the description aligns with by implying mutation. The description adds no extra behavioral details such as whether partial matches are applied, effects on file permissions, or error handling. It does not contradict annotations but adds limited value beyond the annotation.

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 sentences with no filler and is front-loaded with the core use case before routing alternatives. Every word earns its place.

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?

The description covers the core use case, alternatives, and safety via annotations. While it doesn't explain the return diff format or error behavior, the output schema likely provides that. For a moderate-complexity mutation tool with full schema coverage, it is adequate; a 4 because it could add edge cases like multiple matches.

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 coverage is 100%, so parameters are already documented. The description mentions whitespace-tolerant fallback, which hints at allow_fuzzy, and dry-run, but doesn't add new meaning beyond what the schema provides; baseline 3 is appropriate.

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 states a specific verb ('replace') and resource ('known text block in one file') and mentions a whitespace-tolerant fallback and optional dry-run. It is clear but does not explicitly distinguish from some similar tools like replace_in_files or edit_document, though it names write_file and replace_lines.

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?

It explicitly provides when to use (replacing a known text block) and when not to use alternatives, naming write_file for whole-file replacement and replace_lines for line ranges. This provides strong routing guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources