Skip to main content
Glama

Parse an e-invoice into JSON

parse_invoice
Read-onlyIdempotent

Reads CII, UBL, XRechnung, Peppol XML, or Factur-X/ZUGFeRD PDF invoices into a structured invoice object for review, editing, or re-issuance. Use validate_invoice to check rules.

Instructions

Reads an e-invoice (CII, UBL, XRechnung or Peppol XML, or a Factur-X / ZUGFeRD PDF) into the structured invoice object that create_invoice accepts, with money in integer minor units. Use it to answer questions about a received invoice, to edit one, or to re-issue it with create_invoice. It does not check any rules, so use validate_invoice for that, and convert_invoice to change syntax directly. For a PDF, visibleTotals shows whether the totals printed on the page match the embedded XML, which exposes a tampered or mismatched PDF. A document it cannot read comes back as an error result with the reason. Runs locally.

Input Schema

NameRequiredDescriptionDefault
xmlNoThe invoice as XML text (CII, UBL Invoice/CreditNote, XRechnung, Peppol BIS). Provide this OR pdfBase64.
pdfBase64NoA Factur-X / ZUGFeRD PDF/A-3 as base64; the embedded XML is used. Provide this OR xml.

Output Schema

NameRequiredDescriptionDefault
formatYesSyntax of the source document.
originYesWhether the input was XML or a PDF.
invoiceYesThe Invoice object, in the shape of the create_invoice input schema.
visibleTotalsNoPDF only: comparison of the printed totals with the embedded XML.
embeddedFilenameNoPDF only: name of the embedded XML that was read.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • addedOutput schema / properties / embeddedFilename / description
      Added value: +"PDF only: name of the embedded XML that was read."
    • addedOutput schema / properties / format / description
      Added value: +"Syntax of the source document."
    • addedOutput schema / properties / origin / description
      Added value: +"Whether the input was XML or a PDF."
  2. First observedv0.2.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already cover readOnly/idempotent/non-destructive, and the description adds behavior beyond them: output is the same object create_invoice accepts with money in integer minor units, unreadable documents return an error result with a reason, and it runs locally. The visibleTotals disclosure for PDFs (page totals vs embedded XML, exposing tampering) is precisely the kind of non-obvious behavioral detail an agent cannot get from annotations.

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?

Purpose and accepted formats are front-loaded in the first clause, then usage, sibling routing, PDF caveat, and error behavior follow in descending priority. Every sentence carries distinct information; the 'exposes a tampered or mismatched PDF' clause is a short payoff, not padding.

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?

For a two-parameter read tool with a full output schema and complete annotations, the description supplies everything else an agent needs: accepted syntaxes, output contract, failure mode, and the three sibling-routing decisions. Nothing material is left to inference.

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% and both parameters already document the 'provide this OR pdfBase64' exclusivity, so the baseline is 3. The description reinforces that a PDF path exists and explains what the embedded XML yields, but it adds no format or precedence detail beyond what the schema states.

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?

The description names a specific verb and resource (reads an e-invoice into a structured invoice object) and enumerates the exact accepted syntaxes (CII, UBL, XRechnung, Peppol XML, Factur-X/ZUGFeRD PDF). It goes further by tying the output to create_invoice's input shape with integer minor units, which lets an agent distinguish it from validate_invoice and convert_invoice without opening any schema.

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?

It gives explicit use cases (answer questions about a received invoice, edit one, re-issue it with create_invoice) and explicit exclusions with named alternatives: no rule checking, so use validate_invoice; to change syntax directly, use convert_invoice. This is the full when/when-not/alternative triad.

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