Skip to main content
Glama
Paperboy

Paperboy

Official
by sudostash

ocr_pdf

DestructiveIdempotent

Make scanned PDFs searchable by adding an invisible Tesseract OCR text layer to a copy, so text can be searched, selected, and copied without changing page appearance.

Instructions

Make a scanned PDF searchable: write a copy (default "_ocr.pdf") whose pages carry an invisible text layer recognised by Tesseract OCR, so text can be searched, selected and copied (search_text, extract_text and redact_pdf's texts then work on it). The pages look exactly as before: pictures are not re-rendered or re-compressed. Needs the tesseract command installed.

language: Tesseract language codes joined by +, e.g. "eng" (default), "deu", "eng+fra"; only installed languages work. pages: a page spec (default all). skip_pages_with_text (default true) leaves pages that already have text (including an earlier OCR layer) alone, listed in pages_with_text; false reads them too, which can duplicate their text. dpi 150-600 (default 300, best for most scans; very large pages are read at less). Each page reports its words and Tesseract's mean confidence (0-100; below about 70, expect misread words: check with view_pages). Pages are read upright as displayed; text printed sideways on a page isn't found. Pages with very large content (over 16 MB or 500,000 tokens) are refused. Needs the owner password if the PDF forbids copying. Signed PDFs are refused. At most 10 minutes per call, including waiting while other calls use Tesseract (4 pages at a time in all): OCR a long document in parts with pages.

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": "ocr_pdf"
  }
}

Input Schema

NameRequiredDescriptionDefault
dpiNo
pagesNo
languageNoeng
passwordNo
overwriteNo
input_pathYes
output_pathNo
skip_pages_with_textNo

Output Schema

NameRequiredDescriptionDefault
pagesYes
wordsYes
outputYes
languageYes
pages_with_textYes
password_protectedYes
user_password_changedYes
permissions_restrictedYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.1

TDQS

A4.5/5.0
Behavior4/5

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

Annotations only flag a write/destructive, idempotent, closed-world operation; the description adds substantial context: an output copy is written with a default name, the tesseract binary must be installed, only installed languages work, signed PDFs are refused, oversized pages are refused, there is a 10-minute cap with 4-way concurrency, and sideways text is missed. The "any password can be 'ask'" note is valuable auth behavior. Minor tension: it warns that skip_pages_with_text=false "can duplicate their text," which reads as non-idempotent, while idempotentHint=true, but the default behavior is consistent with the annotation.

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?

Front-loads the core action and effect in the first sentence, then moves through parameters and constraints with no filler. Dense but every clause carries operational information an agent needs (limits, defaults, failure modes).

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?

An output schema exists, so return values need not be documented, yet the description still notes the useful return signals (per-page words and mean confidence, pages_with_text). For an 8-parameter destructive write tool it covers the failure modes, limits, dependency, and password handling an agent would otherwise discover only by erroring.

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 0%, so the description must carry parameter meaning, and it largely does: language format ("+"-joined codes, installed only), pages ("a page spec (default all)"), skip_pages_with_text (default true, pages listed in pages_with_text, duplication risk when false), and dpi (150-600, default 300, downscaled on large pages). input_path is self-evident and output_path is implied by the default "<name>_ocr.pdf", but overwrite and password semantics beyond the "ask" escape hatch are left unstated.

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 resource ("Make a scanned PDF searchable") plus the concrete effect: a copy with an invisible Tesseract text layer. It also names exactly which sibling tools then work on the result (search_text, extract_text, redact_pdf), so the agent can place it in a workflow without opening any schema.

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?

Explains the precondition (scan needs a text layer before text tools can read it) and the debugging route for poor results ("check with view_pages"). It also prescribes chunking "OCR a long document in parts with pages" when the 10-minute cap is hit. It stops short of an explicit "do not run this on PDFs that already have text" exclusion, although skip_pages_with_text's default partly implies it.

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