Skip to main content
Glama

Generate compliant invoice XML

generate_invoice
Read-onlyIdempotent

Generate compliant e-invoice XML from a JSON invoice, in either EN 16931 syntax. Profiles: en16931, xrechnung-ubl, peppol-bis-3, xrechnung-cii, facturx-en16931 — the profile chooses the syntax, and xrechnung-cii and facturx-en16931 come back as CII. The invoice is validated first and generation is refused if it fails, because emitting XML for an invalid invoice produces a file that passes nothing. CREDIT NOTES GENERATE TOO, from the same object: invoiceTypeCode "381" emits a UBL CreditNote document under the UBL profiles and ram:TypeCode 381 under the CII ones, since CII has one document for both. XML ONLY, NEVER A PDF: Factur-X and ZUGFeRD files are CII XML inside a PDF/A-3 container, and this tool builds no container, so a facturx-en16931 result is the payload and not a Factur-X document — do not tell the user otherwise. If they need the PDF itself, no tool here returns one; the HTTP API does, on every plan: POST https://api.attestwire.com/v1/generate?format=pdf with the same invoice and profile facturx-en16931 returns a Factur-X / ZUGFeRD PDF (EN 16931 profile), with the CII XML inside as factur-x.xml, watermarked "not for sending" on the free plan and clean on a paid one. On xrechnung-cii the generator's own FIXTURE documents were run through the official KoSIT validator on release and accepted; on facturx-en16931 they were not, because that profile's BT-24 matches no XRechnung scenario for the validator to judge. Neither is a verdict on the document you just generated — nothing is sent to KoSIT at call time, so never call it "KoSIT-validated". REQUIRES AN API KEY and costs 1 document.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
invoiceYesThe invoice to generate XML for, as an InvoiceInput object. Required: profile (one of en16931, xrechnung-ubl, xrechnung-cii, facturx-en16931, peppol-bis-3, or "auto" to have it chosen from the buyer: its Leitweg-ID, country and electronic address), invoiceNumber, issueDate ("YYYY-MM-DD"), currency (ISO 4217), seller {name, address{city, postalCode, countryCode}}, buyer {name, address{...}}, and lines[] of {id, description, quantity, unitCode, unitPrice, vatCategory, vatRate}. The XRechnung profiles additionally require buyerReference (BT-10), a seller contact {name, phone, email}, and payment instructions — see BR-DE-1/2/5/6/7/15 via the explain_rule tool. A CREDIT NOTE IS THE SAME OBJECT with invoiceTypeCode (BT-3) set to "381": there is no separate tool and no separate shape, the same rules run, and the amounts stay POSITIVE — the type code is what conveys the direction of the money, so negative amounts on a credit note reverse it back into an invoice. Full schema: https://api.attestwire.com/openapi.json

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / invoice / description
      Previous value: -"The invoice to generate XML for, as an InvoiceInput object. Required: profile (one of en16931, xrechnung-ubl, xrechnung-cii, facturx-en16931, peppol-bis-3), invoiceNumber, issueDate (\"YYYY-MM-DD\"), currency (ISO 4217), seller {name, address{city, postalCode, countryCode}}, buyer {name, address{...}}, and lines[] of {id, description, quantity, unitCode, unitPrice, vatCategory, vatRate}. The XRechnung profiles additionally require buyerReference (BT-10), a seller contact {name, phone, email}, and payment instructions — see BR-DE-1/2/5/6/7/15 via the explain_rule tool. A CREDIT NOTE IS THE SAME OBJECT with invoiceTypeCode (BT-3) set to \"381\": there is no separate tool and no separate shape, the same rules run, and the amounts stay POSITIVE — the type code is what conveys the direction of the money, so negative amounts on a credit note reverse it back into an invoice. Full schema: https://api.attestwire.com/openapi.json"New value: +"The invoice to generate XML for, as an InvoiceInput object. Required: profile (one of en16931, xrechnung-ubl, xrechnung-cii, facturx-en16931, peppol-bis-3, or \"auto\" to have it chosen from the buyer: its Leitweg-ID, country and electronic address), invoiceNumber, issueDate (\"YYYY-MM-DD\"), currency (ISO 4217), seller {name, address{city, postalCode, countryCode}}, buyer {name, address{...}}, and lines[] of {id, description, quantity, unitCode, unitPrice, vatCategory, vatRate}. The XRechnung profiles additionally require buyerReference (BT-10), a seller contact {name, phone, email}, and payment instructions — see BR-DE-1/2/5/6/7/15 via the explain_rule tool. A CREDIT NOTE IS THE SAME OBJECT with invoiceTypeCode (BT-3) set to \"381\": there is no separate tool and no separate shape, the same rules run, and the amounts stay POSITIVE — the type code is what conveys the direction of the money, so negative amounts on a credit note reverse it back into an invoice. Full schema: https://api.attestwire.com/openapi.json"
  2. First observed

TDQS

A4.9/5.0
Behavior5/5

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

The description discloses far more than annotations: validation-first refusal, credit note behavior with type code 381, CII vs UBL output, the PDF/container distinction, KoSIT validation history, API key requirement, and cost per document. These are critical behavioral traits beyond the readOnly/idempotent/destructive hints, and none contradict the annotations.

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 description is long but information-dense; every sentence earns its place. It is front-loaded with the core purpose, then details profiles, credit notes, PDF caveats, and API alternatives. The only minor structural weakness is that it is a single dense paragraph rather than using bullet points or short sections, which slightly hampers scannability.

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?

Given the tool's complexity—multiple profiles, credit notes, validation, PDF limitations, and validator nuances—the description is remarkably complete. It covers output formats, validation behavior, credit note handling, the no-PDF rule, an alternative HTTP API endpoint for PDFs, auth/cost requirements, and KoSIT caveats. Nothing essential is missing for an agent to call it correctly.

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

Parameters5/5

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

Even though schema coverage is 100%, the description adds substantial meaning beyond the schema: credit notes use the same object with invoiceTypeCode '381', amounts must stay positive, negative amounts reverse the direction, profile 'auto' selection logic, and a link to the full OpenAPI schema. This materially helps an agent construct the correct invoice object.

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 states a specific verb ('Generate') and resource ('compliant e-invoice XML from a JSON invoice'), then enumerates the exact profiles and output syntaxes. It clearly differentiates the tool from siblings by emphasizing 'XML ONLY, NEVER A PDF' and noting that no tool here returns a PDF. This leaves no ambiguity about what the tool produces.

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?

The description gives explicit when-to-use guidance: generate XML for any of the listed profiles, with 'auto' profile selection described. It also gives a clear when-not-to-use exclusion: if a PDF is needed, no tool here returns one, and it points to the HTTP API endpoint instead. It further warns against claiming KoSIT validation for generated documents, preventing misuse.

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