Skip to main content
Glama

jade.replace_text

Replace an exact, unique string in a file using content anchors instead of line numbers; it refuses absent or ambiguous matches and supports atomic multi-site edits.

Instructions

Replace an exact, unique string in a file. An anchor string does not move when the lines around it do, which is why follow-up edits address text rather than line numbers. Refuses when the anchor is absent or matches more than once — extend it with surrounding context to disambiguate. For several sites, use apply: atomic, one validation, no diagnostics from half-done intermediate states.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesFile path to edit.
newTextYesReplacement text.
oldTextYesExact text to replace. Must appear exactly once.
expectedDigestNoOptional. The digest from the read this edit is based on; the edit is refused if the file changed since, by anyone.
expectedRevisionNoRevision expected before editing.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.0.10

TDQS

A4.4/5.0
Behavior4/5

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

No annotations are provided, so the description carries the full burden. It discloses a safety-critical behavior—refusing when the anchor is absent or matches more than once—and explains why anchor-based edits are stable over line numbers. It does not explicitly state that the file is modified or describe post-edit confirmation, but the core refusal and stability behaviors are transparently presented.

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?

Three tightly packed sentences: the first defines the operation, the second explains the rationale for anchor-based edits, and the third states constraints and routes to the appropriate sibling. No filler; every sentence 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?

Covers the operation, uniqueness requirement, disambiguation strategy, and alternative for multi-site edits. With no output schema and no annotations, it could have mentioned success/return behavior, but the parameter schema already covers the inputs and the description handles the essential behavioral context adequately.

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 baseline is 3. The description adds practical framing for oldText (exact, unique, extend for disambiguation), which reinforces the schema, but it does not meaningfully expand on path, newText, expectedDigest, or expectedRevision beyond their schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource: 'Replace an exact, unique string in a file.' It clearly distinguishes itself from sibling tools by framing edits as anchor-based rather than line-based and by redirecting multi-site edits to apply. Purpose is immediately recognizable.

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?

Explicitly instructs when to use an alternative: 'For several sites, use apply.' It also provides conditional guidance for the main use case—when the anchor is absent or duplicated, extend it with surrounding context to disambiguate. This gives clear decision rules for correct usage.

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