Skip to main content
Glama

Agent Data Tools: Documents to text

Extract data from a document: invoice, receipt, contract fields as JSON

document_extract
Read-only

Extract named fields from a document as JSON: give a PDF, Word, Excel or PowerPoint file, a scan or a photo (PNG, JPEG, WebP) by URL or in a POST body (up to 10 MB; images 3 MB) and the field names you want, such as invoice_number, total, due_date. An AI model reads the file, scans by OCR, and returns one JSON object, with null where a value is not stated. Use to turn invoices, receipts, orders and contracts into rows. Price $0.03/call via x402 USDC or a card key (/credits), first 25 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

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": {
      "url": "<url>",
      "fields": "<fields>"
    },
    "name": "document_extract"
  }
}

Input Schema

NameRequiredDescriptionDefault
urlYesAbsolute public http(s) URL of the file (or send the file in a POST body instead)
fieldsYesComma-separated field names to extract (1-30). For rows, give the row keys in brackets: line_items[description,quantity,amount]

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.9/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the OCR/AI-model processing path, the null-for-missing-value return semantics, upload size limits (10 MB, 3 MB images), and the pricing model ($0.03/call, 25 free, failed calls free). It also explains why the tool is non-idempotent ('each call is charged, so repeats are not free'), tying behavior directly to the idempotentHint=false annotation.

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?

The core capability and the required inputs are front-loaded in the first sentence, with usage, pricing and safety notes following in decreasing priority. The opening sentence is long and packs format lists, size limits and field examples together, but every sentence carries information an agent needs.

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?

With no output schema, the description steps in to say the tool returns one JSON object with nulls for absent values, and it covers input modalities, size limits and cost. The only gap is that the row/bracket field syntax and the POST-body alternative are left to the schema descriptions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so both parameters are already documented in the schema and the baseline is 3. The description does add some value by naming example field values (invoice_number, total, due_date) and by stating input modalities and size limits, but the bracket row syntax (line_items[...]) is only in the schema, not the description.

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 description opens with a specific verb and resource ('Extract named fields from a document as JSON') and enumerates supported formats (PDF, Word, Excel, PowerPoint, scans, PNG/JPEG/WebP), so the agent knows exactly what the tool produces. It stops short of naming a sibling (e.g. document_text or pdf_extract) as the alternative for full-text reading, so differentiation is implied rather than explicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Use to turn invoices, receipts, orders and contracts into rows' gives a concrete use case and implicitly excludes free-text extraction. However, there is no explicit when-not guidance or named alternative for the sibling tools such as document_text, extract or pdf_extract, so the agent must infer the boundary.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.