Skip to main content
Glama

Extract Data from Document

talonic_extract

Extract structured, schema-validated JSON from PDFs, scans, images, DOCX files, emails, or photos, returning requested fields with per-field confidence scores.

Instructions

Extract structured, schema-validated JSON from a document: PDF, scan, image, DOCX, email, or photo. Returns the requested fields with per-field confidence scores.

USE WHEN: the user asks to extract data from a document, turn a PDF into JSON, pull fields from a file, or parse a scan / form / statement / receipt / report, for common (invoice, contract) or unusual document types. NOT FOR: full plain text (use talonic_to_markdown) · finding documents (use talonic_search / talonic_filter). BY NAME: if the user names a file, call talonic_search first to get its document_id, then call this. ARGS: define the fields you want with inline schema (JSON Schema, e.g. {type:'object',properties:{vendor_name:{type:'string'}}}) OR a saved schema_id, not both. Don't know the fields yet? Set auto_schema:true to let Talonic discover them (open capture) and return a suggested schema you can refine. Provide EXACTLY ONE document source: document_id (cheapest, a workspace doc), file_url (public URL), or file_data+filename (small local files only). COST: each call uses credits; talonic_get_balance shows the remaining balance. RETURNS: data (the JSON), confidence.overall and confidence.fields (treat <0.7 as needs review), document metadata, extraction_id.

Input Schema

NameRequiredDescriptionDefault
schemaNoInline schema definition. REQUIRED unless `schema_id` is provided. Recommended: full JSON Schema {type:'object', properties:{...}}. Also accepted: flat key-type map {field_name:'string', amount:'number'}. Mutually exclusive with `schema_id`.
file_urlNoURL to a document file. The Talonic API fetches it server-side. Use this for documents already on the public web.
filenameNoOriginal filename including extension, e.g. 'invoice.pdf'. Used to infer MIME type when uploading via `file_data`. Required when `file_data` is provided.
file_dataNoBase64-encoded file bytes. Recommended path when the agent already has the file in memory (e.g., the user attached a PDF to the conversation). Pair with `filename` so MIME type can be inferred. Works regardless of where the file lives on disk.
file_pathNoLocal path to a document file. Only works if the MCP server has read access to that path. In sandboxed chat clients (Claude Desktop, Cowork) where uploads land in a host-owned directory, use `file_data` instead.
schema_idNoID of a saved schema. REQUIRED unless `schema` is provided. Accepts UUID or SCH-XXXXXXXX short id from talonic_list_schemas. Mutually exclusive with `schema`.
auto_schemaNoOpen capture: when true, extract WITHOUT providing a schema — Talonic discovers the document's fields and returns them plus a suggested schema you can refine and reuse. Use this when you don't yet know the fields. Mutually exclusive with `schema` and `schema_id`.
document_idNoID of a document already in the workspace, to re-extract with a new schema.
instructionsNoNatural-language guidance for the extractor, e.g. 'Focus on the billing section. Amounts are in EUR.'
include_markdownNoInclude OCR-converted markdown in the response alongside structured data.
include_provenanceNoInclude per-field provenance (source_text, section, page) showing where each value was found in the document.

Output Schema

NameRequiredDescriptionDefault
costNoPer-call cost and post-call balance, parsed from the X-Talonic-* response headers. `null` for non-extract calls; not always present on legacy clients.
dataYesThe extracted structured data, shape determined by the schema.
linksNoURLs for self, document, and human-readable dashboard view.
schemaNoSchema metadata: which schema was used and how it can be saved.
statusYesExtraction status (e.g. 'complete').
documentYesMetadata about the ingested document.
markdownNoOCR-converted markdown. Present only when `include_markdown: true`.
confidenceNoExtraction confidence. Treat fields below ~0.7 as needing human review.
processingNoProcessing metadata: duration, pages processed, region.
provenanceNoPer-field source evidence (source_text, section, page). Present only when `include_provenance: true`.
request_idNoServer-assigned request ID for support and debugging.
extraction_idYesStable identifier for this extraction.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.67
    • addedInput schema / properties / auto_schema
      Added value: +{
      +  "description": "Open capture: when true, extract WITHOUT providing a schema — Talonic discovers the document's fields and returns them plus a suggested schema you can refine and reuse. Use this when you don't yet know the fields. Mutually exclusive with `schema` and `schema_id`.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changedv0.1.25
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": false,
      +  "properties": {
      +    "confidence": {
      +      "additionalProperties": false,
      +      "description": "Extraction confidence. Treat fields below ~0.7 as needing human review.",
      +      "properties": {
      +        "fields": {
      +          "additionalProperties": {
      +            "type": "number"
      +          },
      +          "description": "Per-field confidence map (0..1).",
      +          "propertyNames": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "overall": {
      +          "description": "0..1 confidence for the extraction as a whole.",
      +          "type": "number"
      +        }
      +      },
      +      "required": [
      +        "overall",
      +        "fields"
      +      ],
      +      "type": "object"
      +    },
      +    "cost": {
      +      "anyOf": [
      +        {
      +          "additionalProperties": false,
      +          "properties": {
      +            "balanceCredits": {
      +              "description": "Workspace credit balance after this call settled.",
      +              "type": "number"
      +            },
      +            "cellsResolvedAi": {
      +              "description": "Cells resolved by AI extraction (priced path).",
      +              "type": "number"
      +            },
      +            "cellsResolvedRegistry": {
      +              "description": "Cells resolved from the materialized field-registry (cheap path).",
      +              "type": "number"
      +            },
      +            "costCredits": {
      +              "description": "Credits consumed by this call.",
      +              "type": "number"
      +            },
      +            "costEur": {
      +              "description": "Approximate EUR cost of this call.",
      +              "type": "number"
      +            }
      +          },
      +          "required": [
      +            "costCredits",
      +            "costEur",
      +            "balanceCredits",
      +            "cellsResolvedRegistry",
      +            "cellsResolvedAi"
      +          ],
      +          "type": "object"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "description": "Per-call cost and post-call balance, parsed from the X-Talonic-* response headers. `null` for non-extract calls; not always present on legacy clients."
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "description": "The extracted structured data, shape determined by the schema.",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "document": {
      +      "additionalProperties": false,
      +      "description": "Metadata about the ingested document.",
      +      "properties": {
      +        "filename": {
      +          "type": "string"
      +        },
      +        "id": {
      +          "type": "string"
      +        },
      +        "language_detected": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        },
      +        "mime_type": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        },
      +        "pages": {
      +          "type": "number"
      +        },
      +        "size_bytes": {
      +          "type": "number"
      +        },
      +        "type_detected": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        }
      +      },
      +      "required": [
      +        "id",
      +        "filename"
      +      ],
      +      "type": "object"
      +    },
      +    "extraction_id": {
      +      "description": "Stable identifier for this extraction.",
      +      "type": "string"
      +    },
      +    "links": {
      +      "additionalProperties": false,
      +      "description": "URLs for self, document, and human-readable dashboard view.",
      +      "properties": {
      +        "dashboard": {
      +          "type": "string"
      +        },
      +        "document": {
      +          "type": "string"
      +        },
      +        "self": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "markdown": {
      +      "description": "OCR-converted markdown. Present only when `include_markdown: true`.",
      +      "type": "string"
      +    },
      +    "processing": {
      +      "additionalProperties": false,
      +      "description": "Processing metadata: duration, pages processed, region.",
      +      "properties": {
      +        "duration_ms": {
      +          "type": "number"
      +        },
      +        "pages_processed": {
      +          "type": "number"
      +        },
      +        "region": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "provenance": {
      +      "additionalProperties": {
      +        "additionalProperties": false,
      +        "properties": {
      +          "page": {
      +            "type": "number"
      +          },
      +          "section": {
      +            "type": "string"
      +          },
      +          "source_text": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "description": "Per-field source evidence (source_text, section, page). Present only when `include_provenance: true`.",
      +      "propertyNames": {
      +        "type": "string"
      +      },
      +      "type": "object"
      +    },
      +    "request_id": {
      +      "description": "Server-assigned request ID for support and debugging.",
      +      "type": "string"
      +    },
      +    "schema": {
      +      "additionalProperties": false,
      +      "description": "Schema metadata: which schema was used and how it can be saved.",
      +      "properties": {
      +        "definition": {
      +          "additionalProperties": {},
      +          "propertyNames": {
      +            "type": "string"
      +          },
      +          "type": "object"
      +        },
      +        "id": {
      +          "anyOf": [
      +            {
      +              "type": "string"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ]
      +        },
      +        "save_url": {
      +          "type": "string"
      +        },
      +        "source": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "status": {
      +      "description": "Extraction status (e.g. 'complete').",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "extraction_id",
      +    "status",
      +    "document",
      +    "data"
      +  ],
      +  "type": "object"
      +}
  3. Changed3 schema fields changedv0.1.16
    • addedInput schema / properties / include_provenance
      Added value: +{
      +  "description": "Include per-field provenance (source_text, section, page) showing where each value was found in the document.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / schema / description
      Previous value: -"Inline schema definition. Most reliable: full JSON Schema {type:'object', properties:{...}}. Also accepted: a flat key-type map {field_name:'string', amount:'number'} which the API normalises. Mutually exclusive with `schema_id`."New value: +"Inline schema definition. REQUIRED unless `schema_id` is provided. Recommended: full JSON Schema {type:'object', properties:{...}}. Also accepted: flat key-type map {field_name:'string', amount:'number'}. Mutually exclusive with `schema_id`."
    • changedInput schema / properties / schema_id / description
      Previous value: -"ID of a saved schema. Accepts UUID or SCH-XXXXXXXX short id. Mutually exclusive with `schema`."New value: +"ID of a saved schema. REQUIRED unless `schema` is provided. Accepts UUID or SCH-XXXXXXXX short id from talonic_list_schemas. Mutually exclusive with `schema`."
  4. First observed

TDQS

A4.7/5.0
Behavior4/5

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

Annotations declare readOnlyHint=false/openWorldHint=true, and the description augments this with concrete operational context: each call consumes credits, returned confidence scores should be treated as 'needs review' below 0.7, and a suggested schema is returned in auto_schema mode. It does not clarify the write side effect implied by readOnlyHint=false or any auth requirements, keeping it short of a 5.

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?

Front-loaded one-line summary, then tightly labeled sections (USE WHEN, NOT FOR, BY NAME, ARGS, COST, RETURNS). Each block carries distinct information and the return summary is short since an output schema exists.

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?

For an 11-parameter tool with nested objects and no required params, the description covers source selection, schema definition modes, cost, and return interpretation. With an output schema present, it correctly avoids over-explaining return values while still flagging the confidence threshold.

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 would be 3, but the description adds a cross-parameter constraint the schema cannot express: 'Provide EXACTLY ONE document source' and the mutually-exclusive schema/schema_id choice. It also gives a concrete inline JSON Schema example, adding real selection value.

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 (extract) and resource (structured, schema-validated JSON from a document), and enumerates supported input types (PDF, scan, image, DOCX, email, photo). It explicitly names the siblings it is NOT for (talonic_to_markdown, talonic_search/filter), letting an agent distinguish it without opening any schema.

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?

Dedicated USE WHEN and NOT FOR sections give explicit triggering conditions and named alternatives. It also adds routing rules ('BY NAME... call talonic_search first') and a fallback for unknown fields via auto_schema, so the agent knows exactly which branch to take.

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