Skip to main content
Glama

ac_replace_text

Replace one exact, unique snippet inside a text or script file, with automatic backup and logging for safe config edits.

Instructions

Replace one exact, unique snippet inside a text/script file. Backup + log.

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": {
      "file": "<file>",
      "old": "<old>",
      "new": "<new>"
    },
    "name": "ac_replace_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
newYes
oldYes
fileYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations provided, the description carries the full behavioral burden. It does add real value by disclosing 'Backup + log', telling the agent that a snapshot is taken and the change is recorded before/after mutation, but it omits what happens on a non-unique or missing match, whether the change is reversible via ac_undo, and any permission requirements.

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?

The definition is two short, front-loaded sentences with no filler, and the core constraint appears first. The second sentence is telegraphic ('Backup + log.') but still readable and appropriately brief.

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 three-parameter mutation tool with no annotations and no output schema, the description should cover failure behavior and confirm what is returned after the write. It covers the backup/log side effect and the uniqueness precondition, but leaves error handling and result confirmation unspecified.

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 0%, so all three parameters ('file', 'old', 'new') rely on the description for meaning. The phrasing does map them implicitly: 'file' is the text/script file, 'old' is the exact unique snippet, 'new' is the replacement. That is meaningful compensation but stops short of describing matching semantics such as whitespace or escaping behavior.

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 gives a specific verb and resource ('Replace one exact, unique snippet inside a text/script file'), which is unambiguous about what the tool does. It does not differentiate itself from siblings such as ac_write_text or ac_apply_csp_preset, so an agent must still infer why it would choose this over a full-file write.

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?

The qualifier 'exact, unique' implicitly communicates the precondition for use (the snippet must appear exactly once), which is useful selection context. However, there is no explicit statement of when to prefer this over ac_write_text, nor what to do when the snippet is not unique.

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