Skip to main content
Glama

pdf_ocr

Extract text from scanned PDFs using OCR, and optionally create a searchable PDF with a text layer. Get confidence scores to verify accuracy.

Instructions

Read a scanned PDF with OCR, and optionally add a real text layer to it.

The way to read a page with no text: a scan, or an export that lost its text. Prefer it to pdf_render_pages for reading; run pdf_check_text when unsure. Tesseract is a system install, and a missing binary or language errors with how to install it.

OCR can be confidently wrong, so pages report mean_confidence and low_confidence_words: say when confidence is low rather than presenting text as certain, and look at a bad page with pdf_render_pages.

Text pages are skipped unless force. A long document may stop early; when truncated, do exactly what the summary says, artifact and range included.

Args: ref: PDF file path, or a workspace artifact id. pages: Which pages: "1-10", "3", "1,5,9-12" or "all". Defaults to all. lang: Tesseract language code, or several as "eng+deu". dpi: Resolution, 72 to 600. 200 suits printed text; higher is slower, not better. output: "text", "pdf" for a searchable copy as an artifact, or "both". force: OCR pages that already have text instead of skipping them.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dpiNo
refYes
langNoeng
forceNo
pagesNo
outputNotext

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.3.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries the full behavioral burden and does it well: it discloses Tesseract system dependency and error handling, warns that OCR can be confidently wrong, explains confidence reporting, notes that text pages are skipped unless force, and describes early-stop/truncation behavior.

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?

The description is detailed but every sentence serves a purpose. It front-loads the core action, then provides targeted caveats, usage routing, and parameter semantics. No wasted words, and the structure makes the content easy to scan.

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 complex OCR tool with no annotations, the description is complete: it addresses external dependencies, failure modes, confidence interpretation, edge cases (text pages, truncation), and all parameters. The output schema presumably covers return values, so the description does not need to duplicate that.

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 must fully compensate. The Args section explains every parameter: ref format, pages syntax and default, lang format, dpi range and suitability, output options, and force semantics. This goes well beyond the bare schema.

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 clear verb and resource: 'Read a scanned PDF with OCR, and optionally add a real text layer to it.' It also differentiates from siblings by saying to prefer it to pdf_render_pages for reading and to run pdf_check_text when unsure, so an agent can distinguish it without opening schemas.

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?

The description explicitly says when to use this tool ('a scan, or an export that lost its text') and gives direct alternatives: 'Prefer it to pdf_render_pages for reading; run pdf_check_text when unsure.' This gives the agent clear routing guidance relative to sibling tools.

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