Skip to main content
Glama

generate_erechnung

Read-onlyIdempotent

Generates a German E-Rechnung (ZUGFeRD PDF/A-3b or XRechnung XML) from structured JSON, returning invoice XML or PDF data for compliant B2B/B2G invoicing.

Instructions

Deterministically generate a brand-new German E-Rechnung (ZUGFeRD 2.5 PDF/A-3b or KoSIT XRechnung 3.0.2 XML) from structured JSON (<300ms, exact BigDecimal math & MOD-97 IBAN verification). Use when creating an invoice from structured JSON without an existing PDF; use embed_zugferd_pdf if you already have a visual PDF, or magic_convert_pdf if you only have an unstructured PDF. Returns JSON containing format, filename, mimeType, and either xml (UTF-8 CII XML) or pdfBase64 (Base64 PDF/A-3b).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "invoice": "<invoice>"
    },
    "name": "generate_erechnung"
  }
}

Input Schema

NameRequiredDescriptionDefault
formatNoOutput document format: 'ZUGFERD' renders a human-readable PDF/A-3b with embedded factur-x.xml; 'XRECHNUNG' returns pure UN/CEFACT CII XML.ZUGFERD
invoiceYesStructured German B2B invoice payload conforming to EN 16931 / XRechnung 3.0 / ZUGFeRD 2.5.
profileNoCompliance profile: 'EN16931' for standard German B2B invoices (DATEV ZUGFeRD 2.5 Comfort), or 'XRECHNUNG' for strict KoSIT XRechnung 3.0.2 public-sector rules (requires buyerReference, seller email/phone, buyer email).EN16931
stampGiroCodeNoWhen true, stamps a scannable EPC SEPA GiroCode QR code onto the visual ZUGFeRD PDF using seller.bankDetails[0].iban.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed49 schema fields changedv1.0.1
    • addedInput schema / properties / format / description
      Added value: +"Output document format: 'ZUGFERD' renders a human-readable PDF/A-3b with embedded factur-x.xml; 'XRECHNUNG' returns pure UN/CEFACT CII XML."
    • addedInput schema / properties / invoice / description
      Added value: +"Structured German B2B invoice payload conforming to EN 16931 / XRechnung 3.0 / ZUGFeRD 2.5."
    • addedInput schema / properties / invoice / properties / buyer / description
      Added value: +"Buyer / customer legal entity, postal address, VAT ID, and electronic endpoint (BG-7)."
    • addedInput schema / properties / invoice / properties / buyer / properties / city / description
      Added value: +"Buyer city name (BT-52)."
    • changedInput schema / properties / invoice / properties / buyer / properties / countryCode / description
      Previous value: -"ISO 3166-1 alpha-2, e.g. DE"New value: +"Buyer ISO 3166-1 alpha-2 country code (BT-55), e.g. DE."
    • changedInput schema / properties / invoice / properties / buyer / properties / email / description
      Previous value: -"Buyer email (mandatory on XRECHNUNG: PEPPOL-EN16931-R010)"New value: +"Buyer electronic address email (BT-49; mandatory on XRECHNUNG per PEPPOL-EN16931-R010)."
    • addedInput schema / properties / invoice / properties / buyer / properties / name / description
      Added value: +"Buyer legal company name (BT-44)."
    • addedInput schema / properties / invoice / properties / buyer / properties / phone / description
      Added value: +"Optional buyer contact phone number (BT-57)."
    • addedInput schema / properties / invoice / properties / buyer / properties / street / description
      Added value: +"Buyer street name and house number (BT-50)."
    • changedInput schema / properties / invoice / properties / buyer / properties / vatId / description
      Previous value: -"Buyer VAT ID (required for 0% Reverse Charge AE / Intra-EU K)"New value: +"Buyer VAT ID (BT-48; mandatory for 0% Reverse Charge AE or Intra-EU K)."
    • addedInput schema / properties / invoice / properties / buyer / properties / zip / description
      Added value: +"Buyer postal / ZIP code (BT-53)."
    • changedInput schema / properties / invoice / properties / buyerReference / description
      Previous value: -"Leitweg-ID or buyer PO reference (BT-10, mandatory on XRECHNUNG)"New value: +"Leitweg-ID or buyer PO reference (BT-10; mandatory when profile is XRECHNUNG per BR-DE-15)."
    • changedInput schema / properties / invoice / properties / currency / description
      Previous value: -"ISO 4217 currency code (BT-5)"New value: +"ISO 4217 3-letter currency code (BT-5), default EUR."
    • changedInput schema / properties / invoice / properties / deliveryDate / description
      Previous value: -"Service/delivery date in YYYY-MM-DD (BT-72)"New value: +"Service or delivery date in ISO YYYY-MM-DD format (BT-72)."
    • changedInput schema / properties / invoice / properties / dueDate / description
      Previous value: -"Payment due date in YYYY-MM-DD (BT-9)"New value: +"Payment due date in ISO YYYY-MM-DD format (BT-9)."
    • addedInput schema / properties / invoice / properties / grossTotal / description
      Added value: +"Optional total gross payable amount including VAT (BT-112); verified against netTotal + vatTotal."
    • changedInput schema / properties / invoice / properties / invoiceNumber / description
      Previous value: -"Unique invoice number (BT-1), e.g. RE-2026-001"New value: +"Unique invoice number (BT-1), e.g. RE-2026-001."
    • changedInput schema / properties / invoice / properties / issueDate / description
      Previous value: -"Invoice issue date in YYYY-MM-DD (BT-2)"New value: +"Invoice issue date in ISO YYYY-MM-DD format (BT-2)."
    • addedInput schema / properties / invoice / properties / items / description
      Added value: +"Non-empty list of invoice line items (BG-25)."
    • addedInput schema / properties / invoice / properties / items / items / description
      Added value: +"Single invoice line item with net unit price, quantity, and VAT rate."
    • addedInput schema / properties / invoice / properties / items / items / properties / description / description
      Added value: +"Optional detailed item description (BT-154)."
    • addedInput schema / properties / invoice / properties / items / items / properties / lineTotalNet / description
      Added value: +"Optional net line total (BT-131); verified against quantity * unitPriceNet within 0.02 EUR."
    • addedInput schema / properties / invoice / properties / items / items / properties / name / description
      Added value: +"Item or service title (BT-153)."
    • addedInput schema / properties / invoice / properties / items / items / properties / quantity / description
      Added value: +"Billed quantity (BT-129), e.g. 10."
    • changedInput schema / properties / invoice / properties / items / items / properties / taxCategoryCode / description
      Previous value: -"Optional S, AE, K, E, G, Z, O (auto-inferred when omitted)"New value: +"Optional EN 16931 VAT category code (BT-151): S, AE, K, E, G, Z, or O; auto-inferred when omitted."
    • changedInput schema / properties / invoice / properties / items / items / properties / taxExemptionReason / description
      Previous value: -"Optional 0% VAT exemption reason (BT-120)"New value: +"Optional 0% VAT exemption reason text (BT-120), e.g. § 19 UStG Kleinunternehmer."
    • changedInput schema / properties / invoice / properties / items / items / properties / unit / description
      Previous value: -"Human unit or UN/ECE Rec 20 code (Stk, Std, Tage, pauschal, kg, piece, hour)"New value: +"Human unit or UN/ECE Rec 20 code (BT-130), e.g. Stk, Std, Tage, pauschal, kg, piece, hour."
    • addedInput schema / properties / invoice / properties / items / items / properties / unitPriceNet / description
      Added value: +"Net unit price excluding VAT (BT-146)."
    • changedInput schema / properties / invoice / properties / items / items / properties / vatPercent / description
      Previous value: -"19, 7, or 0"New value: +"Applicable German VAT rate percentage (BT-152), typically 19, 7, or 0."
    • addedInput schema / properties / invoice / properties / netTotal / description
      Added value: +"Optional total net invoice amount excluding VAT (BT-109); verified against sum of line items."
    • changedInput schema / properties / invoice / properties / paymentTermsDescription / description
      Previous value: -"Payment terms text (BT-20)"New value: +"Human-readable payment terms or skonto text (BT-20; required if dueDate is omitted)."
    • addedInput schema / properties / invoice / properties / seller / description
      Added value: +"Seller / supplier legal entity, postal address, tax identifiers, contact point, and SEPA bank account (BG-4)."
    • addedInput schema / properties / invoice / properties / seller / properties / bankDetails / description
      Added value: +"Seller SEPA bank accounts for wire transfer and EPC GiroCode QR generation (BG-17)."
    • addedInput schema / properties / invoice / properties / seller / properties / bankDetails / items / description
      Added value: +"SEPA credit transfer bank account entry."
    • addedInput schema / properties / invoice / properties / seller / properties / bankDetails / items / properties / accountHolder / description
      Added value: +"Optional account holder name (BT-85); defaults to seller.name."
    • addedInput schema / properties / invoice / properties / seller / properties / bankDetails / items / properties / bic / description
      Added value: +"Optional SWIFT/BIC bank identifier code (BT-86)."
    • changedInput schema / properties / invoice / properties / seller / properties / bankDetails / items / properties / iban / description
      Previous value: -"SEPA IBAN passing ISO 13616 MOD-97"New value: +"SEPA IBAN passing ISO 13616 MOD-97 checksum (BT-84)."
    • addedInput schema / properties / invoice / properties / seller / properties / city / description
      Added value: +"Seller city name (BT-37)."
    • changedInput schema / properties / invoice / properties / seller / properties / countryCode / description
      Previous value: -"ISO 3166-1 alpha-2, e.g. DE"New value: +"Seller ISO 3166-1 alpha-2 country code (BT-40), e.g. DE."
    • changedInput schema / properties / invoice / properties / seller / properties / email / description
      Previous value: -"Seller email (mandatory on XRECHNUNG: BR-DE-7 / R020)"New value: +"Seller contact & electronic endpoint email (BT-43 / BT-34; mandatory on XRECHNUNG per BR-DE-7 and PEPPOL-EN16931-R020)."
    • addedInput schema / properties / invoice / properties / seller / properties / name / description
      Added value: +"Seller legal company name (BT-27)."
    • changedInput schema / properties / invoice / properties / seller / properties / phone / description
      Previous value: -"Seller phone >=3 digits (mandatory on XRECHNUNG: BR-DE-6)"New value: +"Seller contact phone number with at least 3 digits (BT-42; mandatory on XRECHNUNG per BR-DE-6)."
    • addedInput schema / properties / invoice / properties / seller / properties / street / description
      Added value: +"Seller street name and house number (BT-35)."
    • changedInput schema / properties / invoice / properties / seller / properties / taxNumber / description
      Previous value: -"German Steuernummer"New value: +"Seller local German tax number / Steuernummer (BT-32)."
    • changedInput schema / properties / invoice / properties / seller / properties / vatId / description
      Previous value: -"USt-IdNr., e.g. DE123456789"New value: +"Seller VAT ID / USt-IdNr. with country prefix (BT-31), e.g. DE123456789."
    • addedInput schema / properties / invoice / properties / seller / properties / zip / description
      Added value: +"Seller postal / ZIP code (BT-38)."
    • addedInput schema / properties / invoice / properties / vatTotal / description
      Added value: +"Optional total VAT amount (BT-110); verified against VAT category breakdown."
    • addedInput schema / properties / profile / description
      Added value: +"Compliance profile: 'EN16931' for standard German B2B invoices (DATEV ZUGFeRD 2.5 Comfort), or 'XRECHNUNG' for strict KoSIT XRechnung 3.0.2 public-sector rules (requires buyerReference, seller email/phone, buyer email)."
    • addedInput schema / properties / stampGiroCode / description
      Added value: +"When true, stamps a scannable EPC SEPA GiroCode QR code onto the visual ZUGFeRD PDF using seller.bankDetails[0].iban."
  2. First observedv1.0.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description goes well beyond them: determinism, a <300ms latency expectation, exact BigDecimal arithmetic, MOD-97 IBAN verification, and the precise shape of the returned JSON (format, filename, mimeType, xml or pdfBase64). With no output schema, that return-value disclosure is genuinely load-bearing rather than redundant.

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?

Three sentences: what it produces, when to use it versus alternatives, and what it returns. Each sentence carries distinct information, the key capability is front-loaded, and there is no filler or repetition.

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 tool with four top-level parameters, deep nested invoice objects, and no output schema, the description covers the missing piece (return payload) while the schema covers inputs exhaustively. An agent has everything needed to select and invoke it correctly.

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%, so every parameter (format, profile, invoice, stampGiroCode, and all nested BT fields) is already documented in the schema, making 3 the baseline. The description adds little parameter-level meaning beyond naming the two format variants, which the schema's enum descriptions already explain in more detail.

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 — 'Deterministically generate a brand-new German E-Rechnung' — and pins down the two concrete output artefacts (ZUGFeRD 2.5 PDF/A-3b or KoSIT XRechnung 3.0.2 XML) plus the input form (structured JSON). It also names the sibling tools it is not, so an agent can separate it from embed_zugferd_pdf and magic_convert_pdf 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?

Explicitly gives the when-to-use condition ('creating an invoice from structured JSON without an existing PDF') and two named alternatives with the discriminating condition for each (existing visual PDF → embed_zugferd_pdf; unstructured PDF → magic_convert_pdf). This is exactly the routing information an agent needs.

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