Skip to main content
Glama

Smart OCR — PDF, Invoice & Receipt to JSON/Table API

extract_document_table

Idempotent

Extract structured table rows (line items, transactions, headers, document metadata, summary totals, Markdown table, and CSV) from a PDF or image (invoice, bank statement, credit card statement, receipt, timesheet, or scanned table). Works immediately on the free tier (2 free documents/day) or with an optional Smart OCR API key.

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": "extract_document_table"
  }
}

Input Schema

NameRequiredDescriptionDefault
presetNoDocument preset: "invoice" for vendor invoices/bills, "bank_statement" for bank or credit card statements, "receipt" for retail/expense receipts, or "auto" to auto-detect.
api_keyNoOptional Smart OCR API key from https://smartocr.dev (can also be sent via x-api-key header). If omitted, uses the free tier (2 free docs/day).
file_urlNoPublic HTTP/HTTPS URL to a PDF, PNG, JPG, WEBP, or TIFF document to extract.
file_nameNoOptional filename with extension (e.g., "invoice.pdf", "statement.pdf", "receipt.png"). Defaults to "document.pdf".
file_base64NoBase64-encoded document content (raw base64 or data:...;base64,... URI). Provide either file_url or file_base64.
custom_headersNoOptional list of custom column headers to extract (e.g., ["Date", "Description", "Amount", "Balance"]).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.7/5.0
Behavior4/5

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

Beyond the annotations, the description discloses two operationally important traits: a rate/quota limit of 2 free documents per day and the optional Smart OCR API key as an alternative auth path (also sendable via x-api-key header). It stops short of describing failure behavior (e.g., unreachable file_url) or the response shape, and the readOnlyHint=false annotation is left unexplained for what is an extraction operation.

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?

Two sentences, front-loaded with the verb and outputs, then the operational tier/auth note. The long parenthetical output-and-document-type list is somewhat dense and reads partly as promotional enumeration, but it carries real routing information.

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 six optional parameters, no required inputs, and no output schema, the description covers the source formats, document types, output formats, and auth/quota model, which is enough to call it correctly. The remaining gap is that the actual response structure (JSON envelope vs. raw CSV/Markdown) is not stated anywhere, since no output schema exists.

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% and every parameter is self-documented, including the preset enum, so the description only needs to add value. It does contribute a useful mapping hint by listing "credit card statement" alongside the bank_statement preset, but it adds nothing for custom_headers, file_base64, or file_url selection.

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?

Starts with a specific verb+resource ("Extract structured table rows") and enumerates the concrete outputs (line items, headers, totals, Markdown table, CSV) plus supported document types, so the agent knows exactly what it produces. It never names the sibling extract_document_json, so the table-vs-JSON distinction is only inferred from the word "table" and the CSV/Markdown mention.

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?

The document-type list (invoice, bank statement, receipt, timesheet, scanned table) implies when the tool applies, and the free-tier/API-key sentence tells the agent how to run it. There is no explicit when-not guidance and no comparison against extract_document_json or get_smartocr_status, leaving the agent to infer routing.

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.

Resources