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 build writes no container, so a facturx-en16931 result is the payload and not a Factur-X document — do not tell the user otherwise. 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. 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), 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

TDQS

A4.6/5.0
Behavior5/5

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

The description discloses important behaviors beyond annotations: validation-before-generation with refusal on invalid invoices, the lack of KoSIT validation at call time, cost and API key requirement, and the CII vs UBL syntax differences. No contradictions with 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 densely packed with necessary details, and it is front-loaded with the core purpose. Each sentence contributes value, though a bit more trimming could improve readability.

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 complex tool with one nested parameter and no output schema, the description thoroughly covers validation flow, profile selection, credit note behavior, PDF caveat, and authentication/cost requirements. It leaves no critical gaps.

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?

The schema already covers the parameter thoroughly (100% coverage), and the description adds meaningful context: credit note handling via invoiceTypeCode '381', profile-specific requirements for XRechnung, and the note that amounts remain positive on credit notes.

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 clearly states the tool's function with a specific verb and resource: 'Generate compliant e-invoice XML from a JSON invoice.' It also lists supported profiles and distinguishes itself from sibling validation tools by focusing on generation.

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?

The description provides clear context on when to use the tool, including handling credit notes and the XML-only limitation (never PDF). It also explains profile-specific behavior, but it does not explicitly name alternatives like validate_invoice for validation-only tasks.

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.

TDQS

A4.7/5.0
Disambiguation5/5

Each tool targets a distinct resource and action: validation (two input formats), generation, rule explanation, company readiness, VIES status, platform listing, key issuance, and upgrade link. Even the two validation tools are clearly split by input type (JSON vs XML), and the descriptions explicitly prevent confusion.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (check_, explain_, generate_, get_, issue_, list_, validate_). The verbs are precise and the nouns clearly indicate the target, with no mixing of conventions or vague terms.

Tool Count5/5

Nine tools is well within the ideal scope for a specialized e-invoicing compliance server. Each tool serves a distinct purpose in the workflow—validate, generate, explain, check company/VIES/platform status, and manage API keys—without redundancy or bloat.

Completeness5/5

The tool surface covers the full lifecycle of e-invoicing compliance: validation (JSON and XML), generation, rule explanation, and external status checks (company, VIES, approved platforms). API key management and upgrade paths are also included. No obvious missing operations for the stated purpose.

Resources