sgbr_locate_text
sgbr_locate_textLocate a phrase in a scanned book’s uncorrected OCR: searches content first, then scans pages when needed, returning matching pages, context snippets, and optional regions for image verification.
Instructions
Locate a phrase in a scanned book's OCR and return the page(s) it is on. Asks the platform's content search (whole words, exact accents) and, when that finds nothing, scans the pages' OCR for the phrase as a substring; engine says which answered. For each hit returns the page, a context snippet, and line/word regions with bbox_px + region_pct (feed region_pct to sgbr_inspect_image to crop/verify; regions is best-effort and may be empty — the page and snippet still stand). Text is uncorrected Fraktur OCR, so expect misses. Searches one volume — for a multivolume work it returns the ordered sibling volumes so you can call again with the next scan_id, and unsearched_scans names any other scan the record lists (a volume or another library's copy) that went unsearched. A fold-out plate id is refused (a plate is one page; its scan_id is the parent volume's) — pass the parent scan_id to search the volume.
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": {
"phrase": "<phrase>"
},
"name": "sgbr_locate_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Record id from an sgbr_search result. Resolves its scan id automatically and enables sibling-volume enumeration for multivolume works. Provide this OR scan_id. | |
| level | No | Region granularity for each hit. | line |
| engine | No | "auto" (default) asks the platform's content search — the website viewer's search, the whole volume in one call — and falls back to the page scan when it finds nothing or cannot run. "page_scan" also finds the phrase inside longer words, in other accent forms, and split across a line break. "content_search" never falls back. | auto |
| phrase | Yes | Text to locate, as a phrase. Content search matches it as whole words, case-insensitively but with exact accents; the page scan matches it as a case/diacritic-insensitive substring of normalized OCR (Fraktur long-ſ folded, hyphen-at-linebreak joined). | |
| scan_id | No | Scan id directly (e.g. "ZBZ-00123359"), from sgbr_get_record's digital.scan_id. Skips the id→scan lookup but yields no sibling volume list (no record to derive it from). Provide this OR id. | |
| max_hits | No | Cap on matching pages returned (default 10, max 50); hOCR is fetched only for these. | |
| max_pages | No | Cost cap on pages the page scan reads from start_page (default 500, max 2000); the scan also stops early at the 404 page boundary. Content search always covers the whole volume. | |
| start_page | No | 1-based page to begin at (resume within a large volume, or past the last hit). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| hits | Yes | ||
| level | Yes | ||
| engine | Yes | ||
| phrase | Yes | ||
| scan_id | Yes | ||
| ocr_note | Yes | ||
| siblings | Yes | ||
| warnings | No | ||
| truncated | Yes | ||
| start_page | Yes | ||
| failed_pages | Yes | ||
| pages_failed | Yes | ||
| pages_scanned | Yes | ||
| returned_hits | Yes | ||
| next_start_page | Yes | The page after the scan window, set when the scan stopped at max_pages: pass it as start_page to scan further. Null otherwise. | |
| scans_unsearched | Yes | ||
| unsearched_scans | Yes | ||
| regions_truncated | Yes | ||
| truncation_reason | Yes | ||
| volume_page_count | Yes |