Skip to main content
Glama

WritersLogic agent-infra

patch-anchor

Apply a unified-diff hunk or search/replace edit to a file by content, refusing ambiguity — Applies unified-diff hunks (wrong line numbers are fine) or search/replace blocks to a supplied file text and returns the patched text, for an agent whose edit tool failed or whose diff has drifted line numbers. Each hunk is located by its content against the original file, trying exact, trailing-whitespace, outer-whitespace then collapsed-whitespace matching; the rung used is reported per hunk. I

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>"
    },
    "name": "patch-anchor"
  }
}

Input Schema

NameRequiredDescriptionDefault
diffNoSingle-file unified diff, at most 64 hunks and 400 anchor lines each. Header counts and line numbers are ignored except as a reported hint. Give either diff or edits.
fileYesCurrent file text, at most 524288 UTF-8 bytes and 100000 lines. A leading BOM is preserved.
editsNoSearch/replace blocks, matched as whole lines against the original file; all are located before any is applied.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

Score is being calculated.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources