Skip to main content
Glama

invoicelens_extract_invoice

Read-onlyIdempotent

Extract structured invoice fields from PDFs—vendor, dates, line items, totals—and validate arithmetic to flag misreads or incorrect invoices.

Instructions

Extract one invoice into structured fields (vendor, invoice number, dates, currency, line items, subtotal, tax, total) and check them: line items vs subtotal, subtotal + tax vs total, tax rate, dates.

validation.valid = false means the numbers don't add up — either a misread (retry with feedback) or an invoice that is genuinely wrong. Values are reported as printed, never silently corrected.

Input Schema

NameRequiredDescriptionDefault
pathNoPath to a PDF on the server's filesystem (local/stdio use only).
doc_idNoAn ingested document's doc_id (from ingest or search).
feedbackNoValidation errors from a previous attempt, to guide a corrected re-read.
collectionNoIndex to use, e.g. 'default' or a per-client name. Lowercase letters, digits, '-', '_'.
pdf_base64NoThe PDF file content, base64-encoded. Use this when the server is remote.

Output Schema

NameRequiredDescriptionDefault
doc_idNo
invoiceYes
filenameNo
extractorYes
validationYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description still adds substantive behavior: which cross-checks run (line items vs subtotal, subtotal + tax vs total, tax rate, dates) and the key non-obvious guarantee that values are reported as printed and never silently corrected. The interpretation of validation.valid=false as either a misread or a genuinely wrong invoice tells the agent how to react, not just what happened.

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?

Front-loaded with purpose and outputs, then the validation semantics, with no filler sentences. The awkward line break mid-sentence ('The check covers:') slightly hurts readability but nothing is wasted.

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?

An output schema exists, so return-shape detail is not required, yet the description still explains the one field an agent must interpret (validation.valid). Combined with the retry loop, it is sufficient to call and recover. Multiple mutually exclusive input sources are only handled by the schema, not the prose, which is the remaining gap.

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 description coverage is 100%, so the schema already explains path, doc_id, feedback, collection and pdf_base64, including the local-vs-remote distinction. The description reinforces `feedback` as the retry channel but adds no format or constraint detail beyond it; baseline 3 is appropriate.

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 and resource ('Extract one invoice into structured fields') and enumerates the fields produced, so an agent knows exactly what comes back. The single-invoice scope also distinguishes it implicitly but clearly from invoicelens_search_documents and invoicelens_ingest_document.

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

Usage Guidelines4/5

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

Gives a concrete conditional workflow: when validation.valid is false, retry with `feedback`. That is real when-to-use guidance for the retry path. It stops short of naming alternatives or stating prerequisites (e.g. that doc_id requires a prior ingest), so it is clear context rather than full routing guidance.

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