extract_document
Converts text, images, or PDFs into template-shaped JSON with per-field confidence scores, helping agents verify extracted values.
Instructions
Turn a document into JSON shaped like template, with a calibrated confidence (0-1) for every field.
template: the shape of the answer; each leaf names a type: "verbatim-string" (copied exactly), "string", "number", "integer", "date" (YYYY-MM-DD), "date-time", "boolean", ["a", "b"] (pick one), [["a", "b"]] (pick any), ["string"] (a list), or [{...}] (a list of objects, e.g. line items). Example: {"merchant": "verbatim-string", "total": "number", "date": "date", "items": [{"name": "verbatim-string", "price": "number"}]} Give the document as exactly one of: text: the document as text. image: a JPEG or PNG, base64 or a data URL (a photo, scan or screenshot of one page). pdf: a PDF with a text layer, base64. file_path: a JPEG/PNG, PDF or text file on this machine (local server only). instructions: optional guidance, e.g. "dates are day/month/year" or "amounts in kobo".
Long documents (over 120,000 characters) are split into parts, extracted in parallel and merged; that can take minutes. Missing values come back as null. Treat fields with confidence below about 0.95 as needing a check.
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": {
"template": "<template>"
},
"name": "extract_document"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | |||
| text | No | ||
| image | No | ||
| template | Yes | ||
| file_path | No | ||
| instructions | No |