Skip to main content
Glama

Replace text (overlay)

pdf_replace_text

Find an exact string in a PDF page and overlay a white patch with replacement text. Intended for cosmetic fixes only; original text remains copyable and is not redacted.

Instructions

Find a string on a page and draw a white patch with the replacement on top. IMPORTANT: this is an overlay, not a true content-stream edit — the original text layer stays, so copy-paste still returns the old string. Font is substituted with Helvetica (Latin-1 only). Use it for cosmetic fixes, not for redaction.

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>",
      "find": "<find>",
      "replace": "<replace>"
    },
    "name": "pdf_replace_text"
  }
}

Input Schema

NameRequiredDescriptionDefault
allNoreplace every match (default: first only)
outNo
findYesexact substring as it appears in a single text item
pageNolimit to one page
pathYes
replaceYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.4

TDQS

A4.1/5.0
Behavior4/5

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

With no annotations provided, the description carries the full burden and largely succeeds: it discloses that the original text layer is preserved, that copy-paste returns the old string, and that fonts are forced to Helvetica with Latin-1 limits. What it omits is failure/write behavior — what happens when no match is found, and whether output goes to `out` or overwrites `path`.

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?

Three tight sentences, front-loaded with the mechanism, then the critical caveat, then the use-case boundary. Every sentence carries distinct decision-relevant information; no filler.

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 mutation tool with no annotations and no output schema, the description covers the most dangerous surprise (silent non-destructive overlay, stale text layer) and the font limitation. It is slightly incomplete on output destination and no-match behavior, which matters because `out` exists as a parameter.

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 only 50%: `path`, `replace`, and `out` have no schema documentation, and the description adds no meaning for any of them — notably the crucial distinction between writing to `out` versus editing in place. The prose mentions a page and a replacement conceptually but never maps to the six parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and mechanism: 'Find a string on a page and draw a white patch with the replacement on top.' The follow-up ('overlay, not a true content-stream edit') removes any ambiguity about what the tool actually does, which no sibling (extract, compress, merge, split, ocr, inspect) does.

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?

Gives an explicit positive case ('cosmetic fixes') and an explicit exclusion ('not for redaction'), which is the decision boundary an agent most needs. It stops short of naming what to use instead for true redaction/content editing, so the agent must infer the alternative.

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