Skip to main content
Glama
surgical-editing-server

surgical-editing-server

Surgical replace

surgical_replace

Apply exact-match code replacements across one or more files as a single atomic transaction; if any snippet fails, no files are written. Use dry_run to preview a unified diff.

Instructions

Transactional exact-match editor. Send ONLY the minimal snippets to change, across one or more files. Each find must appear exactly once in its file. All operations are atomic: if any replacement fails, no file is written. On a miss, the error points to the most similar line so you can retry without re-reading. Set dry_run to get a unified diff without writing.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "surgical_replace"
  }
}

Input Schema

NameRequiredDescriptionDefault
dry_runNoValidate and return a unified diff without writing. Default false.
file_pathNoLegacy single-file form; prefer `operations`.
operationsNoEdits to apply as one transaction. Operations on the same file compose in order.
replacementsNoLegacy single-file form; used with `file_path`.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does most of it well: exact-match uniqueness, all-or-nothing atomicity, helpful miss diagnostics ('points to the most similar line'), and dry_run diff behavior. It omits permissions, file-creation semantics, encoding, and the success response, which are meaningful gaps for a mutation tool.

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?

Five short sentences, each earning its place: purpose, input discipline, uniqueness rule, atomicity/error recovery, and dry-run. The most important constraint (minimal snippets) is front-loaded.

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?

For a multi-parameter mutation tool with no output schema and no annotations, the description covers atomicity, error recovery, and dry-run thoroughly. It could say more about what happens when a target file is missing or how success is reported, but it is very close to complete.

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 coverage is 100%, so the schema already documents every parameter, including the exact-match uniqueness rule and the dry_run diff behavior. The description largely restates these structured facts and adds little syntax or format detail beyond them, making the baseline 3 appropriate.

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: an exact-match, transactional file editor that operates across one or more files. The scope ('minimal snippets', exact-match) is concrete enough to distinguish it from a general file-writer, though there are no siblings to differentiate against.

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

Usage Guidelines4/5

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

Clearly directs the agent to send only minimal snippets and explains the atomic/fail-fast contract plus the dry_run escape hatch. It gives strong usage context but does not name explicit alternatives or situations when this tool should not be used.

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

Deploy Server

Other Tools