Skip to main content
Glama

Recognize text (OCR)

recognize_text
Idempotent

Run OCR on scanned PDFs or images offline to add an invisible text layer, making Turkish/English text searchable, selectable, and copyable. Use it when pages have no extractable text.

Instructions

Recognizes the text of scanned pages or images (Turkish and English, offline, no upload) and writes a copy of the PDF with an invisible text layer, so the text can be searched, selected and copied. Use it when get_pdf_info lists pages without text or extract_text returns them empty; then run extract_text, search_pdf or export_table on the output. Pages that already have text are left as they are. Scans below 150 dpi are skipped unless force is true, as their text is mostly misread. Takes a few seconds per page. The original is not changed, and an existing output file is only replaced with overwrite: true.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path of the PDF or image.
forceNoAlso recognize low-resolution scans.
pagesNoPages as 1-based numbers and ranges, e.g. "1-3,5". All pages when omitted; a page outside the document is an error.
outputYesAbsolute path of the new PDF. If the file exists, the call fails unless overwrite is true.
passwordNoPassword, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it.
overwriteNoAllow replacing an existing file (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.9
    • changedInput schema / properties / output / description
      Previous value: -"Absolute path of the PDF to write."New value: +"Absolute path of the new PDF. If the file exists, the call fails unless overwrite is true."
    • changedInput schema / properties / pages / description
      Previous value: -"Pages, e.g. \"1-3,5\" (1-based). All pages when omitted."New value: +"Pages as 1-based numbers and ranges, e.g. \"1-3,5\". All pages when omitted; a page outside the document is an error."
    • changedInput schema / properties / password / description
      Previous value: -"Password, if the PDF is encrypted."New value: +"Password, if the PDF is encrypted. Without it an encrypted PDF cannot be opened; with it, it can be read, but tools that write a new PDF cannot save it."
  2. Added

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the annotations: offline/no-upload operation, language coverage, that low-DPI scans are skipped unless force is true, runtime of seconds per page, that the original is unchanged, and that an existing output is only replaced with overwrite: true. This is exactly the extra context annotations can't convey.

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?

Purpose is front-loaded and every following clause carries new operational information — trigger condition, follow-up tools, skip rule, timing, and file-safety semantics. No sentence is redundant.

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?

With no output schema, the description still defines the return artifact (a new PDF with a searchable text layer), the safety model, and the downstream workflow, which is everything an agent needs to invoke and chain this tool correctly.

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 100%, so the baseline is 3, but the description adds real meaning: the rationale for force (low-resolution scans are mostly misread) and the destructive condition gated by overwrite. Minor parameters like pages and password are left entirely to the 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?

States a specific verb+resource ('recognizes the text of scanned pages or images') plus the concrete artifact produced ('writes a copy of the PDF with an invisible text layer'), which cleanly separates it from sibling read-only tools like extract_text and get_pdf_info.

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 trigger ('use it when get_pdf_info lists pages without text or extract_text returns them empty'), names the follow-up tools to run on the output, and states the exclusion that pages already containing text are left untouched. Alternatives and conditions are all spelled out.

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