Skip to main content
Glama

WritersLogic agent-infra

edit-anchor-check

Check that an edit's old-string occurs exactly once in a file, with match contexts — Counts how many times an old-string occurs in a supplied file text (as a replace-in-file tool would see it) and returns each match's offset, line, column and surrounding lines, for an agent about to issue an edit. pass: exactly one literal match, even counting overlapping ones. unknown: several matches, or one match that overlaps another occurrence of the same text (ambiguous; contexts show how to

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>",
      "oldString": "<oldString>"
    },
    "name": "edit-anchor-check"
  }
}

Input Schema

NameRequiredDescriptionDefault
fileYesFile text, at most 524288 UTF-8 bytes and 100000 lines.
oldStringYes
contextLinesNoLines of context before and after each listed match. Default 2.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description must carry the full behavioral burden. It does useful work — declaring literal matching, that overlapping occurrences count, and that it reports offsets, line/column and surrounding lines — but the verdict enumeration is cut off mid-sentence ("contexts show how to"), so the outcome set is left incomplete for a tool whose whole value is the verdict.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The core purpose is front-loaded in the first clause, which is good. But the trailing "pass:/unknown:" enumeration is telegraphic and the text terminates mid-sentence, so the structure is compromised and a reader cannot tell whether content was lost.

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?

No output schema exists, so the description must describe return values — and it does, listing offset, line, column and surrounding lines plus a verdict. The only real gap is the truncated verdict enumeration, meaning the failure condition is never defined even though 'pass' and 'unknown' are.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 67% (file and contextLines are documented; oldString is not). The description compensates by specifying that matching is literal and that overlapping occurrences are counted, which is precisely the semantic an agent needs for oldString. Only the byte/line limits are left to the schema.

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: counting occurrences of an edit's old-string in file text and returning match offsets/lines/columns with context. It clearly frames this as a pre-edit validation step. It does not name or contrast with any sibling, so 4 rather than 5.

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?

"for an agent about to issue an edit" implies the when-to-use moment, and the pass/unknown verdict list hints at decision logic. However, there is no explicit statement of when NOT to use it or which sibling (e.g. patch-anchor) handles the adjacent case, so guidance is implied rather than stated.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources