Skip to main content
Glama

Validate an invoice file: UBL or CII XML, or a Factur-X / ZUGFeRD PDF

validate_invoice_xml
Read-onlyIdempotent

Validate an e-invoice FILE the user already has: a UBL 2.1 Invoice, a UBL 2.1 CreditNote, a UN/CEFACT CII CrossIndustryInvoice (invoices and credit notes alike), or a Factur-X or ZUGFeRD PDF. The file is read into the invoice model and EN 16931 plus the CIUS rules (XRechnung UBL and CII, Peppol BIS 3) run over it, returning the same teaching errors as validate_invoice, plus which syntax it read, the document's BT-24/BT-23 and unmapped: everything in the file that did not reach the model. Use it when someone says "this invoice was rejected, why?" and hands you a file. Send the file as-is; do not work out the syntax or the document type first, because the tool decides both and reports them. XML goes in xml, as text. A PDF goes in pdf_base64, as the file's bytes base64-encoded, never pasted as text (the whole call is capped at 1 MB, so about 750 KB of PDF; larger files go to POST /v1/validate as application/pdf). The XML attached to the PDF is judged the same way, and the attachment and XMP metadata are checked too, as AW-PDF-* warnings and information that do not change valid; PDF/A conformance and whether the page agrees with the XML are not checked. Keyless, with no upload: npx @attestwire/en16931 validate invoice.pdf. A credit note is NOT refused — send it exactly like an invoice. It is a pre-flight, not an authority: a file that passes here can still be rejected by KoSIT or by a receiving platform, so say so, and pass on the unmapped list, where an entry of kind "unknown" is content the rules never saw. Costs 1 document, and works without an API key for 30 documents a day per IP address.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "validate_invoice_xml"
  }
}

Input Schema

NameRequiredDescriptionDefault
xmlNoAn XML file: the complete document, as text — the file contents, not a path. Its root element must be <Invoice> in the UBL Invoice-2 namespace, <CreditNote> in the UBL CreditNote-2 namespace, or <CrossIndustryInvoice> in the UN/CEFACT CII namespace. Exactly one of xml or pdf_base64.
pdf_base64NoA Factur-X or ZUGFeRD PDF: the file's bytes, base64-encoded (a data: URL prefix and line breaks are fine). Exactly one of xml or pdf_base64.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / pdf_base64
      Added value: +{
      +  "description": "A Factur-X or ZUGFeRD PDF: the file's bytes, base64-encoded (a data: URL prefix and line breaks are fine). Exactly one of xml or pdf_base64.",
      +  "type": "string"
      +}
    • changedInput schema / properties / xml / description
      Previous value: -"The complete document, as text — the file contents, not a path. Its root element must be <Invoice> in the UBL Invoice-2 namespace, <CreditNote> in the UBL CreditNote-2 namespace, or <CrossIndustryInvoice> in the UN/CEFACT CII namespace. Not the bytes of a PDF."New value: +"An XML file: the complete document, as text — the file contents, not a path. Its root element must be <Invoice> in the UBL Invoice-2 namespace, <CreditNote> in the UBL CreditNote-2 namespace, or <CrossIndustryInvoice> in the UN/CEFACT CII namespace. Exactly one of xml or pdf_base64."
    • removedInput schema / properties / xml / minLength
      Removed value: -1
    • removedInput schema / required
      Removed value: -[
      -  "xml"
      -]
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint and idempotentHint, but the description adds substantial context beyond them: a 1 MB call cap (~750 KB of PDF), a cost of 1 document, a keyless quota of 30 documents/day per IP, and the caveat that this is a pre-flight that KoSIT or a receiving platform may still reject. It also scopes the PDF checking precisely, stating that AW-PDF-* attachment/XMP findings do not change `valid` while PDF/A conformance and page-vs-XML agreement are not checked at all.

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?

It is front-loaded with the formats and the core behavior, then usage, then caveats, which is a sensible order, and nearly every sentence carries operational information. It runs long as a single dense block, and the closing cost/quota sentence would read better as a separate clause, but no sentence is genuinely filler.

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?

There is no output schema, and the description compensates by explaining the return payload: teaching errors, which syntax was read, the document's BT-24/BT-23, and `unmapped` content including entries of kind "unknown". Combined with the pre-flight caveat and the size/quota limits, an agent has everything needed to call it correctly and interpret the result.

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 real routing meaning: XML must go in `xml` as the file's text, while a PDF goes in `pdf_base64` as base64-encoded bytes and must never be pasted as text. The size guidance tied to the base64 field further helps an agent decide which parameter to populate, exceeding 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 ('Validate') and a precise resource ('an e-invoice FILE the user already has'), then enumerates exactly which formats qualify: UBL 2.1 Invoice, UBL 2.1 CreditNote, UN/CEFACT CII CrossIndustryInvoice, and Factur-X/ZUGFeRD PDF. It also distinguishes itself from its closest sibling by noting it returns 'the same teaching errors as validate_invoice, plus which syntax it read', so an agent can tell the file-based tool apart from the model-based one.

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 a concrete triggering scenario ('when someone says "this invoice was rejected, why?" and hands you a file') and an explicit negative instruction not to pre-classify ('do not work out the syntax or the document type first, because the tool decides both'). It also routes the oversized-file case to an alternative ('larger files go to POST /v1/validate as application/pdf') and reassures that credit notes are accepted, removing the main ambiguity an agent would have.

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