Skip to main content
Glama

Apply Text Replacement

apply_text_replacement

Performs an exact, single text replacement in an approved file, enabling targeted edits to file content without rewriting the entire document.

Instructions

Make an exact single text replacement in an approved file.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>",
      "old_text": "<old_text>",
      "new_text": "<new_text>"
    },
    "name": "apply_text_replacement"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYes
new_textYes
old_textYes

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.8/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden. It implies a mutation, but says nothing about behavior when old_text is absent, when it appears multiple times, whether the write is atomic or reversible, or what permissions are needed. 'Exact single' is the only behavioral signal and it is left implicit.

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?

A single front-loaded sentence with no filler or redundancy. It is efficient, though its brevity reflects under-specification rather than disciplined editing.

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?

An output schema exists, so return values need not be described. However, for a three-parameter write tool with zero schema coverage and no annotations, the description omits critical matching and failure semantics that an agent needs before calling it safely.

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%, so the description must compensate for all three undocumented parameters. It partially constrains old_text (exact match, single occurrence) but adds nothing about path format/allowed roots or the semantics of new_text, leaving most parameter meaning to inference.

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 names a specific verb and resource: making an exact single text replacement in a file. An agent can tell this is a mutate-file-contents tool. It does not distinguish itself from plausible siblings such as apply_self_update, and 'approved file' is never defined.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance, no statement of prerequisites, and no alternatives named. The phrase 'approved file' implies a whitelist restriction but the description never says what makes a file approved or what happens if it is not, so the agent cannot verify eligibility before invoking.

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