Skip to main content
Glama

fs_replace

Replace an exact string in a UTF-8 file to make precise edits. Fails when target text is missing or ambiguous, preventing unintended changes.

Instructions

Make a precise text edit by replacing an exact string in a UTF-8 file. Fails when the target text is absent or ambiguous.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
agentNoOptional existing runtime binding for monitor attribution; no extra handshake.
newTextYes
oldTextYes
replaceAllNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already disclose the safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false), lowering the bar. The description still adds real value by disclosing a failure mode ('fails when the target text is absent or ambiguous') and the UTF-8 encoding constraint, which are not derivable from structured fields.

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?

Two sentences, zero waste, with the core purpose and the failure condition front-loaded. Nothing redundant or padded.

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

Completeness3/5

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

For a mutating, 5-parameter tool with 20% schema coverage and a nested object, the description leaves gaps: it never explains replaceAll's replace-one-vs-replace-all semantics, whether the file must already exist, or atomicity. No output schema exists, so return behavior is also unaddressed.

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 only 20%, so the description must compensate; it gives semantic meaning to path, oldText (exact target) and newText, but is silent on replaceAll (the most consequential flag, defaulting to false) and on the nested agent parameter. Partial compensation only.

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 ('replacing an exact string in a UTF-8 file') and a precise scope ('exact string'), which implicitly distinguishes it from whole-file writes. However, it never names or contrasts with the sibling fs_write, so an agent must infer the distinction rather than read it.

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?

Usage is only implied: the phrase 'precise text edit' suggests this is for surgical edits when the exact target text is known. There is no explicit when-to-use, when-not-to-use, or routing to alternatives such as fs_write or fs_search despite those siblings existing.

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