Skip to main content
Glama

Invoice/receipt to JSON

invoice_json
Read-only

Send exactly one of url, text, or file_base64 + mime_type. 3 free MCP calls per day (all tools together), then $0.0075 USDC per page via x402 or card credits (paid in-band: params._meta["x402/payment"]). Invoice or receipt (PDF, PNG/JPEG/WebP image, or plain text) to structured JSON with a fixed schema: vendor (name, address, VAT ID, email, phone, IBAN), customer, invoice number, order number, issue/due date, currency (ISO 4217), subtotal, VAT total, total, amount due, VAT breakdown and line items. Every field has value, the verbatim source quote and a confidence score (0-1: quote found in the document, value matches quote, totals add up). Arithmetic checks included. $0.0075 per page (max 10 pages per call; the 402 quotes pages x $0.0075), 1 free call per caller (up to 3 pages). Runs on Cloudflare Workers AI only (PDF text layer via toMarkdown, OCR for images); documents are not stored. Scanned PDFs without a text layer: send page images. POST JSON {url} or {file_base64, mime_type} or {text}, or POST the raw file (Content-Type application/pdf or image/*); GET ?url= or ?text= also works. When to use: Use invoice-json for invoices and receipts (fixed accounting schema, quotes, arithmetic checks). Use extract-json for any other short text with your own JSON schema. Use page-rag to turn a web page into Markdown for retrieval. Pay by card instead of crypto: put a Gumroad license key from https://freetier.gumroad.com/l/gvyfk in params._meta["x-license-key"] (or HTTP header X-License-Key); 7.5 credits ($0.0075) per page, rounded down per call. Time limit about 22 s per call; on timeout or error nothing is charged or settled.

Input Schema

NameRequiredDescriptionDefault
urlNopublic http(s) URL of a PDF, PNG, JPEG or WebP invoice/receipt (max 8 MB)
textNoinvoice text instead of a file (max 40,000 chars)
mime_typeNowith file_base64: application/pdf, image/png, image/jpeg, image/webp or text/plain
file_base64Nobase64 of a PDF/PNG/JPEG/WebP file (max 8 MB); set mime_type too

Output Schema

NameRequiredDescriptionDefault
inputNo
modelNo
pagesNo
checksNo
limitsNo
totalsNo
vendorNo
missingNo
sourcesNo
currencyNo
customerNo
due_dateNo
billed_usdNo
issue_dateNo
line_itemsNo
text_charsNo
order_numberNo
document_typeNo
payment_termsNo
vat_breakdownNo
invoice_numberNo
confidence_methodNo
overall_confidenceNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / description
      Previous value: -"Inferred from a real response captured on 2026-10-24; extra fields may appear, null-valued fields are untyped."New value: +"Inferred from a real response captured on 2026-10-26; extra fields may appear, null-valued fields are untyped."
  2. Changed2 schema fields changed
    • changedInput schema / properties / file_base64 / description
      Previous value: -"POST JSON only: base64 file content"New value: +"base64 of a PDF/PNG/JPEG/WebP file (max 8 MB); set mime_type too"
    • changedInput schema / properties / mime_type / description
      Previous value: -"POST JSON only: application/pdf, image/png, image/jpeg, image/webp or text/plain"New value: +"with file_base64: application/pdf, image/png, image/jpeg, image/webp or text/plain"
  3. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "description": "Inferred from a real response captured on 2026-10-24; extra fields may appear, null-valued fields are untyped.",
      +  "properties": {
      +    "billed_usd": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "checks": {
      +      "properties": {
      +        "due_date_not_before_issue_date": {
      +          "type": [
      +            "boolean",
      +            "null"
      +          ]
      +        },
      +        "line_items_sum_equals_subtotal_or_total": {
      +          "type": [
      +            "boolean",
      +            "null"
      +          ]
      +        },
      +        "subtotal_plus_vat_equals_total": {
      +          "type": [
      +            "boolean",
      +            "null"
      +          ]
      +        },
      +        "vat_breakdown_sum_equals_vat_total": {
      +          "type": [
      +            "boolean",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "confidence_method": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "currency": {
      +      "properties": {
      +        "confidence": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "quote": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "value": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "customer": {
      +      "properties": {
      +        "address": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "name": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "vat_id": {
      +          "properties": {
      +            "confidence": {},
      +            "quote": {},
      +            "value": {}
      +          },
      +          "type": "object"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "document_type": {
      +      "properties": {
      +        "confidence": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "quote": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "value": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "due_date": {
      +      "properties": {
      +        "confidence": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "quote": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "value": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "input": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "invoice_number": {
      +      "properties": {
      +        "confidence": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "quote": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "value": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "issue_date": {
      +      "properties": {
      +        "confidence": {
      +          "type": [
      +            "number",
      +            "null"
      +          ]
      +        },
      +        "quote": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        },
      +        "value": {
      +          "type": [
      +            "string",
      +            "null"
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "limits": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "line_items": {
      +      "items": {
      +        "properties": {
      +          "amount": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "confidence": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "description": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "quantity": {},
      +          "quote": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "unit_price": {},
      +          "vat_rate": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "missing": {
      +      "items": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      },
      +      "type": "array"
      +    },
      +    "model": {
      +      "type": [
      +        "string",
      +        "null"
      +      ]
      +    },
      +    "order_number": {
      +      "properties": {
      +        "confidence": {},
      +        "quote": {},
      +        "value": {}
      +      },
      +      "type": "object"
      +    },
      +    "overall_confidence": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "pages": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "payment_terms": {
      +      "properties": {
      +        "confidence": {},
      +        "quote": {},
      +        "value": {}
      +      },
      +      "type": "object"
      +    },
      +    "sources": {
      +      "items": {
      +        "properties": {
      +          "name": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "note": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "url": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "text_chars": {
      +      "type": [
      +        "number",
      +        "null"
      +      ]
      +    },
      +    "totals": {
      +      "properties": {
      +        "amount_due": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "subtotal": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "total": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "vat_total": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "vat_breakdown": {
      +      "items": {
      +        "properties": {
      +          "amount": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "base": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "confidence": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          },
      +          "quote": {
      +            "type": [
      +              "string",
      +              "null"
      +            ]
      +          },
      +          "rate": {
      +            "type": [
      +              "number",
      +              "null"
      +            ]
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "vendor": {
      +      "properties": {
      +        "address": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "email": {
      +          "properties": {
      +            "confidence": {},
      +            "quote": {},
      +            "value": {}
      +          },
      +          "type": "object"
      +        },
      +        "iban": {
      +          "properties": {
      +            "confidence": {},
      +            "quote": {},
      +            "value": {}
      +          },
      +          "type": "object"
      +        },
      +        "name": {
      +          "properties": {
      +            "confidence": {
      +              "type": [
      +                "number",
      +                "null"
      +              ]
      +            },
      +            "quote": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            },
      +            "value": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "phone": {
      +          "properties": {
      +            "confidence": {},
      +            "quote": {},
      +            "value": {}
      +          },
      +          "type": "object"
      +        },
      +        "vat_id": {
      +          "properties": {
      +            "confidence": {},
      +            "quote": {},
      +            "value": {}
      +          },
      +          "type": "object"
      +        }
      +      },
      +      "type": "object"
      +    }
      +  },
      +  "type": "object"
      +}
  4. Added

TDQS

A4.8/5.0
Behavior5/5

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

Well beyond the readOnlyHint/openWorldHint annotations, it discloses pricing and free-tier limits, the in-band x402 payment parameter, a card-licence alternative, the 10-page/8 MB/22 s caps, that documents are not stored, that failures are not charged, and that it runs on Cloudflare Workers AI. These are exactly the operational traits an agent must know before invoking a paid call.

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?

The critical call-shape constraint (exactly one of url/text/file_base64) is front-loaded, and the use-case routing is placed where it can be scanned. The cost is some redundancy: pricing is stated three times and the free tier twice ("3 free MCP calls per day" vs "1 free call per caller"), which could briefly confuse a reader.

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

Completeness5/5

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

An output schema exists, yet the description still summarizes the returned fields and the value/quote/confidence triple plus arithmetic checks, so an agent knows what it will get. Combined with transport options (POST JSON, raw upload, GET query) and payment paths, nothing needed to call it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% so the baseline is 3, but the description adds a constraint the schema does not express: the inputs are mutually exclusive and exactly one must be supplied (schema has no required fields). It also restates the url/text/file_base64+mime_type grouping, which clarifies how mime_type pairs with file_base64. It does not add format detail 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?

States a specific verb and resource: an invoice/receipt (PDF, image, or text) is converted into structured JSON with a fixed accounting schema, and the schema's fields are enumerated. It explicitly distinguishes itself from extract_json (any text, custom schema) and page_rag (web page to Markdown), so an agent can pick it without opening sibling schemas.

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

Usage Guidelines5/5

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

Contains an explicit "When to use" block naming two alternatives and the condition that selects each: invoices/receipts here, arbitrary text with a custom schema to extract_json, web pages to page_rag. It also gives concrete fallback guidance for scanned PDFs without a text layer (send page images).

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