Skip to main content
Glama

Extract document

extract_document

Extract the text of one document of this tenant (OCR for images, direct read for text files, best-effort for PDF) and optionally pull structured fields. Persists the text on the document so it becomes searchable after the next reindex.

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_id": "<document_id>"
    },
    "name": "extract_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
schemaNoOptional field list/JSON schema to extract, e.g. {invoice_no, date, total}
document_idYesId of the documents row
target_tenant_idNoPlatform super-admins only: operate on this tenant instead of your own.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations declare readOnlyHint=false and openWorldHint=true, and the description does the valuable work of explaining why it isn't read-only: the extracted text is persisted on the document and only becomes searchable after the next reindex. Beyond that it says nothing about cost/latency of OCR, failure modes for the 'best-effort' PDF path, or permission requirements, so the added value is real but narrow.

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 tight sentences, front-loaded with the action and its per-format behavior, then the side effect. No filler or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The persistence-and-reindex side effect is a strong inclusion for a mutation-flagged tool, but with no output schema the description should indicate what comes back (extracted text, structured fields, a job handle) and whether extraction is synchronous. For a tool with nested parameters and a best-effort path, those gaps matter.

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 all three parameters are already documented including the nested schema object. The description reinforces intent ('optionally pull structured fields', 'one document of this tenant') but adds no format or syntax detail beyond the schema, which is the expected baseline.

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?

Names a specific verb (extract) and resource (the text of one document) and breaks down how each source type is handled (OCR for images, direct read for text, best-effort for PDF), which makes it clearly distinct from get_document. It never explicitly names the sibling it replaces, so differentiation is inferred rather than stated.

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?

Usage is implied by the mechanics ('OCR for images, direct read for text files') and by the optional structured-field extraction, so an agent can infer when it applies. There is no explicit when-to-use/when-not guidance, no mention of using get_document for plain metadata, and no stated preconditions.

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