Skip to main content
Glama

Subpay Invoice Reader

Read an invoice and check that it adds up

extract_invoice

Reads invoices, bills and receipts from PDF into structured JSON — vendor, customer, dates, PO, line items, discount, tax, shipping, total, balance due — and checks the arithmetic: quantity × unit price, lines to subtotal, tax rate, total and balance due. The response says exactly which figures don't add up. Returns vendor, customer, invoice number, dates, PO, line items, subtotal, discount, taxes, shipping, total, amount paid and balance due, plus checks (passed true/false, or null when the figures aren't printed). $0.04 per page (up to 25 pages) in USDC per successful read via x402, quoted before you pay; failed reads are free. First 3 reads a day are free (documents up to 10 pages, no payment needed); after that, the usual price.

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": "<document>"
    },
    "name": "extract_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
documentYesThe PDF, base64-encoded (a data: URL prefix is fine). Max about 3 MB and 25 pages.
fileNameNoOriginal file name, if known.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior5/5

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

With no annotations supplied, the description carries the full disclosure burden and does so thoroughly: billing model (x402/USDC), price, free tier with its own page cap, quote-before-pay behavior, free failures, and the null-when-not-printed semantics of the check results. These are exactly the traits an agent needs and none of them are available from structured fields.

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 the arithmetic-check differentiator, then returns, then pricing — a sensible order. It loses a point for redundancy: the extracted field list (vendor, customer, dates, PO, line items, discount, tax, shipping, total, balance due) is enumerated twice, once in the opening sentence and again in the 'Returns …' sentence.

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?

Because there is no output schema, the description correctly spends words on the returned shape and the meaning of the check flags, and it covers pricing, limits and failures. A small gap remains around edge cases such as unreadable or scanned PDFs and whether OCR is applied, which an agent would want to know before paying.

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% for both parameters, so the schema already documents base64 encoding, data-URL prefix tolerance, ~3 MB size and 25-page limits. The description only repeats the PDF and page-limit facts and adds no format or syntax detail for fileName or document beyond the schema.

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?

Opens with a specific verb and resource ('Reads invoices, bills and receipts from PDF into structured JSON') and names a distinctive secondary capability (arithmetic verification) that no sibling 'about' tool offers. The agent knows exactly what it gets back and what value it adds.

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 clear usage context via cost and limits: $0.04/page up to 25 pages, first 3 reads/day free for documents up to 10 pages, quoted before payment and failed reads free — this materially informs when an agent should choose to call it. It stops short of explicit when-not-to-use guidance or naming alternatives, though the only listed sibling is 'about'.

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