Skip to main content
Glama

ocr_document

Read-onlyIdempotent

Force OCR text extraction from scanned PDFs when normal reading returns garbled or empty text; optionally target pages, languages, offsets, and character limits. Requires tesseract and pdftoppm.

Instructions

Force OCR text extraction on a PDF, bypassing normal text extraction. Use this when read_document returns garbled or empty text from a scanned PDF; requires tesseract and pdftoppm. Read-only.

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": {
      "filename": "<filename>"
    },
    "name": "ocr_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
pageNoOptional page number to OCR (1-based). If omitted, OCRs all pages.
offsetNoCharacter offset to start reading from (default 0). A truncated result ends with the offset of the next page.
filenameYesThe PDF filename to OCR
languageNoTesseract language code (default: DOCS_MCP_OCR_LANG, or "eng"). Use "spa" for Spanish, "fra" for French, etc. Run 'tesseract --list-langs' to see available languages.
max_charsNoMaximum characters to return (default 50000, at most 200000).

Output Schema

NameRequiredDescriptionDefault
textYesThe text of this page of the document
next_offsetNoOffset to pass on the next call; absent when this page reaches the end
total_charsYesLength of the whole text in characters

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv1.4.1
    • changedInput schema / properties / language / description
      Previous value: -"Tesseract language code (default: \"eng\"). Use \"spa\" for Spanish, \"fra\" for French, etc. Run 'tesseract --list-langs' to see available languages."New value: +"Tesseract language code (default: DOCS_MCP_OCR_LANG, or \"eng\"). Use \"spa\" for Spanish, \"fra\" for French, etc. Run 'tesseract --list-langs' to see available languages."
    • addedInput schema / properties / max_chars
      Added value: +{
      +  "default": 50000,
      +  "description": "Maximum characters to return (default 50000, at most 200000).",
      +  "maximum": 200000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / offset
      Added value: +{
      +  "default": 0,
      +  "description": "Character offset to start reading from (default 0). A truncated result ends with the offset of the next page.",
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "next_offset": {
      +      "description": "Offset to pass on the next call; absent when this page reaches the end",
      +      "type": "integer"
      +    },
      +    "text": {
      +      "description": "The text of this page of the document",
      +      "type": "string"
      +    },
      +    "total_chars": {
      +      "description": "Length of the whole text in characters",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "text",
      +    "total_chars"
      +  ],
      +  "type": "object"
      +}
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, so the trailing "Read-only" is redundant. The genuinely additive content is the external dependency disclosure (tesseract and pdftoppm), which tells the agent an environment failure is possible; it stops short of noting that OCR is slow or that output quality varies by language pack.

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?

Two sentences, front-loaded with the action and immediately followed by the selection rule and the hard prerequisite. Only the closing "Read-only" is filler against the annotations.

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?

An output schema exists, so return values need no explanation, and the description covers purpose, trigger condition, and runtime dependency. What is missing is any hint about relative cost or that OCR results are typically slower and less reliable than native extraction, which matters for an agent deciding whether to retry.

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

Parameters3/5

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

Schema description coverage is 100%, so page, offset, language, and max_chars are fully documented in the schema itself. The description adds no syntax, defaults, or interaction detail beyond that, which is the correct baseline when the schema does the work.

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 ("Force OCR text extraction on a PDF") plus the key differentiator "bypassing normal text extraction," which separates it from read_document and the other extraction siblings. An agent can choose this tool without opening the schema.

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?

Gives an explicit triggering condition ("Use this when read_document returns garbled or empty text from a scanned PDF") and names the sibling to try first, so the routing decision is unambiguous. No exclusion is stated, but the conditional framing effectively covers when not to use it.

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