Skip to main content
Glama
Paperboy

Paperboy

Official
by sudostash

redact_pdf

DestructiveIdempotent

Permanently remove text, images, and drawings under specified areas, words, or patterns from a PDF, then save a redacted copy with sensitive matches replaced in metadata and comments.

Instructions

Redact a PDF for real: write a copy (default "_redacted.pdf") from which the text, pictures and drawings under the redacted areas are removed, not just covered. Say what to redact with any of:

  • texts: words or phrases, found as search_text finds them (match_case, whole_word);

  • patterns: Python regular expressions, e.g. "[\w.+-]+@[\w-]+.[\w.]+" for email addresses (ignoring case unless match_case);

  • areas: [{"page": 1, "rect": [left, bottom, right, top]}] in PDF points, in the page's own coordinates (as search_text gives rectangles), e.g. for a signature. pages limits where texts and patterns are searched (default all). Every character whose centre is in an area is removed; pictures have the pixels there blanked; drawings wholly inside are removed; annotations touching an area are removed (a form field entirely, with its value). Areas are painted over in fill ("black", "white", or "none"). The texts and patterns are also replaced with "[redacted]" in metadata, bookmarks, comments, form values and alt text anywhere in the file.

Each rewritten page is read back to confirm nothing is left under an area and nothing else changed. A page that can't be redacted exactly (e.g. a font without widths, a picture in JPEG 2000, JBIG2 or CCITT, or a failed check) is replaced by a picture of itself at dpi (72-300) with the areas painted over, so its text can no longer be selected; rasterize="never" refuses such pages instead, "always" rasterizes every redacted page. pages_without_text lists searched pages with no text (scans): their words are pictures, so redact them with areas, or run ocr_pdf first so texts and patterns find them. originals_kept counts pictures or forms redacted here that other pages still show unredacted. Attachments can't be searched; remove them with sanitize_pdf. Needs the owner password if the PDF forbids changes, or forbids changing comments and one is in an area. Signed PDFs are refused. Check the result with view_pages, and search_text on it, before sharing.

Any password argument can be "ask": the user then types it on a local page, so it never passes through the chat.

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": {
      "input_path": "<input_path>"
    },
    "name": "redact_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
dpiNo
fillNoblack
areasNo
pagesNo
textsNo
passwordNo
patternsNo
overwriteNo
rasterizeNoif_needed
input_pathYes
match_caseNo
whole_wordNo
output_pathNo

Output Schema

NameRequiredDescriptionDefault
pagesYes
outputYes
matchesYes
match_countYes
originals_keptYes
pages_searchedYes
also_redacted_inYes
alt_text_removedYes
matches_truncatedYes
pages_without_textYes
password_protectedYes
user_password_changedYes
permissions_restrictedYes
attachments_not_searchedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.1

TDQS

A4.9/5.0
Behavior5/5

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

Beyond the annotations, the description discloses irreversible removal of underlying content, metadata/bookmark/comment replacement, per-page verification, fallback rasterization behavior, fill painting, and constraints around attachments and signed PDFs. This is substantial behavioral context for a destructive operation.

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 description is long but front-loaded and organized with a useful bulleted breakdown of redaction modes. It is mostly justified by the tool's complexity, though a few details such as the originals_kept return-value note could be tighter given the output schema exists.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 13-parameter destructive PDF tool with no schema parameter descriptions, the definition covers the important behavior, constraints, fallback paths, and verification guidance. An agent has enough context to invoke it correctly and understand the major risks.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden, and it does so richly: it explains text and pattern matching, area coordinates in PDF points, pages scoping, fill values, dpi range, rasterize modes, match_case, whole_word, password 'ask', and the default output name. It does not explicitly explain overwrite, but the critical parameters are well covered.

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?

The description states a specific verb and resource: 'Redact a PDF for real' and writes a copy with underlying text, pictures, and drawings removed rather than merely covered. This clearly distinguishes true redaction from overlay-based tools and tells the agent what the operation produces.

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

Usage Guidelines5/5

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

It explicitly explains how to select content via texts, patterns, and areas, and describes when to use ocr_pdf for scanned pages or sanitize_pdf for attachments. It also names verification steps with view_pages and search_text, and states password and signed-PDF constraints.

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