Skip to main content
Glama

replace_text

Destructive

Replace one exact text occurrence in a LaTeX file while preserving surrounding content, using a recent document ID and version to prevent stale edits.

Instructions

Replace exactly one occurrence of oldText in a file, preserving surrounding content. Requires a recent document ID and version. Reports confirmed application separately from final-content verification.

Input Schema

NameRequiredDescriptionDefault
pathYes
newTextYes
oldTextYes
projectIdYes
expectedDocIdYes
expectedVersionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, idempotentHint=false, and openWorldHint=true, so the description's added value is the mutation semantics: single-occurrence replacement, content preservation, a version-freshness requirement, and the distinction between 'confirmed application' and 'final-content verification'. It could go further by stating what happens on zero or multiple matches and on version conflict, but it adds substantive context beyond the annotations and contradicts nothing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the action and its key constraint, with no wasted prose. The final sentence about application versus content verification is slightly opaque in wording but conveys a meaningful behavioral distinction.

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 destructive, six-parameter mutation tool with no output schema, the description covers concurrency expectations and result semantics reasonably well, but omits failure behavior (unmatched or ambiguous oldText, version mismatch), and leaves half the parameters unexplained. Adequate but with clear gaps an agent would want filled before invoking.

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

Parameters2/5

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

Schema description coverage is 0% across six required parameters, so the description must carry the burden and does not. It only implies semantics for oldText ('exactly one occurrence'), path ('in a file'), and expectedDocId/expectedVersion ('recent'); projectId and newText are entirely undocumented, and no format or constraint details are added.

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 and resource with a scope constraint that distinguishes it from a general overwrite: 'Replace exactly one occurrence of oldText in a file, preserving surrounding content.' It does not name or contrast any sibling tool such as write_file or create_file, so an agent must infer where the boundary lies.

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?

Provides a real precondition ('Requires a recent document ID and version'), implying the tool participates in optimistic-concurrency control, which is genuinely useful for choosing it. However, there is no explicit guidance on when to use this versus write_file/create_file, nor on 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.