Skip to main content
Glama

Extract document fields

doc_extract
Read-onlyIdempotent

Extract structured fields from an Arabic document image or PDF (receipts, invoices, official letters, national IDs, bank slips) as JSON: amounts, dates, names, identifiers and tax numbers, with null for fields the document does not contain. Send the file as base64 (jpeg, png or pdf); the limit is 12 MB of base64.

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": {
      "document_base64": "<document_base64>"
    },
    "name": "doc_extract"
  }
}

Input Schema

NameRequiredDescriptionDefault
mime_typeNoDocument MIME type, e.g. image/jpeg.
document_base64YesBase64-encoded document image or PDF.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • removedInput schema / additionalProperties
      Removed value: -false
  2. First observed

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotent/non-destructive, so the safety profile is covered. The description adds genuinely non-obvious operational detail: the 12 MB base64 ceiling, the accepted encodings, and the null-fill policy for absent fields, which prevents the agent from misinterpreting missing keys as errors.

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?

Two sentences, zero padding, with the output shape front-loaded ahead of the input mechanics. Every clause carries information an agent would otherwise have to guess.

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 does the work of describing the return value (field classes plus null handling), and it covers input format and size limits. Slightly thin on whether the output is a flat key set or nested by document type, but sufficient to call correctly.

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 and the baseline is 3. The description contributes the file-size ceiling and constrains the format to jpeg/png/pdf, but adds nothing about the mime_type parameter's relationship to the payload or what happens on mismatch.

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?

States a specific verb and resource ("Extract structured fields from an Arabic document image or PDF") and enumerates both the document classes handled (receipts, invoices, official letters, IDs, bank slips) and the field classes returned. An agent knows exactly what it gets back. It stops short of naming doc_extract_batch as the multi-file alternative, so single-vs-batch differentiation is left implicit.

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 implies appropriate usage contexts (receipts, invoices, IDs), giving more than nothing. But there is no explicit when-to-use/when-not guidance and no reference to the obvious sibling doc_extract_batch for multi-document work, so the agent must infer the routing decision.

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.