Skip to main content
Glama
Filesystem MCP

Filesystem MCP

by domdomegg

String Replace

str_replace
Destructive

Replace an exact, unique string in a file using absolute paths; omit the replacement to delete it. Fails if the target appears zero or multiple times.

Instructions

Replace an exact string in a file.

  • old_str must match exactly and be unique in the file

  • If old_str appears 0 times or more than once, the operation fails

  • If new_str is omitted, old_str is deleted

  • Use absolute paths

Input Schema

NameRequiredDescriptionDefault
pathYesAbsolute path to file
new_strNoReplacement string (omit to delete)
old_strYesExact string to find (must be unique)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and readOnlyHint=false, so the mutation warning is covered. The description goes beyond that by disclosing the failure mode (ambiguous or absent match aborts the operation) and the deletion semantics of an omitted new_str - real behavioral detail an agent needs before calling.

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?

Four tight bullets, front-loaded with the core action, zero filler. Every line carries actionable constraint information.

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?

With no output schema, the description should ideally say what a successful call returns or how the change is reported, and that gap remains. Otherwise the preconditions, failure modes, and path requirement make it complete enough for correct invocation.

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 description coverage is 100%, so the schema already documents path, old_str (unique match) and new_str (omit to delete). The description largely restates that information rather than adding syntax, format, or encoding details, so the baseline 3 applies.

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 opens with a specific verb+resource ("Replace an exact string in a file") and adds behavioral specifics. It distinguishes itself from `view` and `create`, but never explicitly differentiates from the `insert` sibling, which an agent could plausibly confuse with string replacement.

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?

It states operational preconditions clearly (exact unique match required, failure on 0 or >1 occurrences, omit new_str to delete, use absolute paths), which is genuinely useful. However, it gives no guidance on when to choose this tool over `insert`, and no exclusions or alternatives are named.

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

Deploy Server

Other Tools