Skip to main content
Glama
ianderso
by ianderso

ocr_media

Extract text from archival document images by type and language: print via existing sources or Tesseract, handwriting via Transkribus or vision, tables via FamilySearch, volumes via full-text search.

Instructions

Read a document image with the reader that suits it; doc_type and lang choose. print: text the media or its sources already carry, else Tesseract. hand: an English hand returns the image for you to transcribe as the result instructs; German goes to Transkribus only, never a vision read; Norwegian and others to Transkribus, with the image to check. table: FamilySearch's index (get_records_on_image). volume: full-text search first.

Transkribus costs credits: within the monthly budget, or with spend_credits. The transcript is never the evidence; the citation stays on the image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
langNoThe document's language, as a Tesseract code: 'eng', 'deu', 'nor', 'swe', 'dan', 'lat'; 'eng+deu' for several. Chooses the handwriting route and Tesseract's model.eng
pageNoPage of a PDF, from 1.
mediaYesMedia handle or gramps_id.
storeNoKeep a machine reading on the media object as a Transcript note headed with its engine, model and date, plus Transkribus' PAGE XML. A vision read is yours to store, with add_note.
engineNo'auto' routes by doc_type and lang. Or one reader: 'existing' (text the media or its sources already carry), 'tesseract', 'vision' (the image, for you to read; refused for German handwriting), 'transkribus'.auto
regionNoReturn only [x1, y1, x2, y2] of the page, in percent of width and height, at full detail: to read small or faint writing. [0, 50, 100, 100] is the bottom half.
doc_typeNoWhat the document is. 'print': typeset or typed. 'hand': one handwritten document -- will, deed, letter, register entry. 'table': a census page or other ruled form. 'volume': a page of a register or deed book you mean to search whole.print
spend_creditsNoConsent to Transkribus credits (about 0.5, EUR 0.12, a page) for this call, past the configured monthly page budget. Only when the user agreed.
second_witnessNoWith a vision read, also run Transkribus and compare -- for a document that will carry a proof argument. Costs credits.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changedv2.3.0
    • addedInput schema / $defs
      Added value: +{
      +  "DocType": {
      +    "description": "What the document is, which decides how ocr_media reads it.",
      +    "enum": [
      +      "print",
      +      "hand",
      +      "table",
      +      "volume"
      +    ],
      +    "type": "string"
      +  },
      +  "OcrEngine": {
      +    "description": "Which reader ocr_media uses; auto routes by doc_type and lang.",
      +    "enum": [
      +      "auto",
      +      "existing",
      +      "tesseract",
      +      "vision",
      +      "transkribus"
      +    ],
      +    "type": "string"
      +  }
      +}
    • addedInput schema / properties / doc_type
      Added value: +{
      +  "$ref": "#/$defs/DocType",
      +  "default": "print",
      +  "description": "What the document is. 'print': typeset or typed. 'hand': one handwritten document -- will, deed, letter, register entry. 'table': a census page or other ruled form. 'volume': a page of a register or deed book you mean to search whole."
      +}
    • addedInput schema / properties / engine
      Added value: +{
      +  "$ref": "#/$defs/OcrEngine",
      +  "default": "auto",
      +  "description": "'auto' routes by doc_type and lang. Or one reader: 'existing' (text the media or its sources already carry), 'tesseract', 'vision' (the image, for you to read; refused for German handwriting), 'transkribus'."
      +}
    • changedInput schema / properties / lang / description
      Previous value: -"Tesseract language code ('eng', 'deu', 'swe', 'nor', ...)."New value: +"The document's language, as a Tesseract code: 'eng', 'deu', 'nor', 'swe', 'dan', 'lat'; 'eng+deu' for several. Chooses the handwriting route and Tesseract's model."
    • addedInput schema / properties / page
      Added value: +{
      +  "default": 1,
      +  "description": "Page of a PDF, from 1.",
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / region
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "type": "number"
      +      },
      +      "maxItems": 4,
      +      "minItems": 4,
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Return only [x1, y1, x2, y2] of the page, in percent of width and height, at full detail: to read small or faint writing. [0, 50, 100, 100] is the bottom half."
      +}
    • addedInput schema / properties / second_witness
      Added value: +{
      +  "default": false,
      +  "description": "With a vision read, also run Transkribus and compare -- for a document that will carry a proof argument. Costs credits.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / spend_credits
      Added value: +{
      +  "default": false,
      +  "description": "Consent to Transkribus credits (about 0.5, EUR 0.12, a page) for this call, past the configured monthly page budget. Only when the user agreed.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / store
      Added value: +{
      +  "default": false,
      +  "description": "Keep a machine reading on the media object as a Transcript note headed with its engine, model and date, plus Transkribus' PAGE XML. A vision read is yours to store, with add_note.",
      +  "type": "boolean"
      +}
  2. First observedv0.1.0

TDQS

A4/5.0
Behavior4/5

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

Annotations mark this as non-read-only and non-destructive but say nothing about cost or consent; the description fills that gap by stating Transkribus consumes credits (~0.5, EUR 0.12 per page), is gated by a monthly budget, and requires spend_credits only with user agreement. It also flags a real side effect beyond annotations - a stored reading becomes a Transcript note - plus the provenance caveat that the transcript is never the evidence. No claim conflicts with readOnlyHint=false or destructiveHint=false.

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?

Purpose comes first, followed by routing, cost, and provenance - a sensible front-loaded order with no filler sentences. The telegraphic fragment style ('print: text the media or its sources already carry, else Tesseract') is terse but occasionally requires re-reading, costing a little clarity without wasting space.

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?

For a nine-parameter tool with no output schema, the description covers the decision-relevant surface: routing rules, credit cost and consent, and what gets written when store is set. It stops short of describing failure behavior or output shape, and the English-handwriting path ('returns the image for you to transcribe as the result instructs') is only thinly explained.

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 parameter basics are already documented; the description's added value is the routing logic linking doc_type and lang to a concrete engine choice, which the schema enums do not spell out (e.g. German handwriting must never use vision). Details like region coordinates and store semantics are left to the schema, which handles them well.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening clause states a specific verb and resource ('Read a document image') and immediately frames the selection problem ('with the reader that suits it; doc_type and lang choose'). This clearly separates it from the media-management siblings (get_media, attach_media, update_media), though it never names those alternatives directly.

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?

It gives an explicit routing table: print routes to carried text or Tesseract, hand routes by language (English returns the image, German goes to Transkribus and never vision, Norwegian/others to Transkribus), table points to FamilySearch's index via get_records_on_image, and volume starts with full-text search. Alternatives are named for two of four doc types, so this is strong but not a fully enumerated when/when-not rule set.

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