Skip to main content
Glama
books-as-data
by kintopp

sgbr_get_page_ocr

sgbr_get_page_ocr
Read-onlyIdempotent

Fetches a single page's OCR text and block/line/word layout regions with pixel and percentage bounding boxes, so you can crop and visually verify exact page areas.

Instructions

Get one page's OCR text and layout regions (line/word boxes). Fetches IIIF hOCR for a single page and parses it into block/line/word regions, each with a pixel bbox_px and a region_pct — the latter is ready to pass straight to sgbr_inspect_image's region_pct argument to crop and visually verify that exact spot on the page. Also returns the page's plain OCR text (reading order) unless include_text is false. Text is uncorrected OCR, often Fraktur, so expect recognition errors. Identify the page by record id or scan_id plus a page; a fold-out plate id needs no page (it resolves to its own plate page, so a map or table's printed lettering can be read directly). If you do not yet know which page, use sgbr_locate_text to find the page(s) a phrase appears on first.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "sgbr_get_page_ocr"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoRecord id from an sgbr_search result. Resolves its scan id automatically. Provide this OR scan_id.
pageNoScanned-image page, 1-based (same axis as the viewer's ?page=N and sgbr_inspect_image `page`). Omit only for a fold-out plate `id`, which supplies its own plate page; every other address requires it. Passing a page other than a plate's own reads the parent volume instead, so the response `id` is null (that page is not what the plate record stands for).
levelNoGranularity of returned regions. "line" (default) balances detail and size; "word" can be large; "page" returns only the page box + counts.line
scan_idNoScan id from sgbr_get_record (`digital.scan_id`, e.g. "ZBZ-00123359"). Skips the id→scan lookup. Provide this OR id.
max_regionsNoCap on regions returned (default 200, max 2000). Excess regions are dropped in document order; the "truncated" flag reports when this happened.
include_textNoAlso fetch the plain per-page OCR text (reading order). Set false to skip the extra fetch.

Output Schema

NameRequiredDescriptionDefault
idYes
pageYes
textYes
levelYes
countsYes
regionsYes
scan_idYes
hocr_urlYes
ocr_noteYes
text_urlYes
truncatedYes
page_widthYes
viewer_urlYes
page_heightYes
returned_regionsYes
truncation_reasonYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.30.2

TDQS

A4.8/5.0
Behavior5/5

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

The annotations only establish that this is a safe, idempotent, open-world read. The description adds important behavior the annotations can't: text is uncorrected OCR, often Fraktur, so recognition errors are expected; regions are truncated in document order when max_regions is hit; and a fold-out plate id resolves to its own plate page.

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 and output are front-loaded, and every sentence carries information — the OCR quality caveat, addressing rules, and the locate_text routing. It is a single dense paragraph, so structure could be improved, but there is no filler.

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 six optional parameters, a full input schema, and an output schema, the description fully covers what an agent needs: how to address a page, how to control granularity and truncation, and what the returned regions are good for. Nothing material is missing.

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. The description goes beyond by linking the region_pct output to sgbr_inspect_image's argument and spelling out the plate-id addressing edge case, but it largely echoes addressing details already present in the schema's page and id descriptions.

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 opens with a specific verb and resource ('Get one page's OCR text and layout regions'), then concretizes the mechanism (IIIF hOCR parsed into block/line/word regions) and output shape. It is clearly distinguishable from its siblings, naming sgbr_locate_text for page discovery and sgbr_inspect_image for region cropping.

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?

It states the condition that selects the alternative ('If you do not yet know which page, use sgbr_locate_text'), notes the include_text=false escape hatch to skip an extra fetch, and explains how the returned region_pct feeds sgbr_inspect_image. The single-page scope is explicit, implicitly contrasting with whole-volume tools.

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