Skip to main content
Glama

EU e-invoicing and business checks (EN 16931, Peppol, VAT, sanctions)

Validate an e-invoice (EN 16931, XRechnung, Peppol BIS)

validate_einvoice
Read-onlyIdempotent

Validate an EU e-invoice XML (UBL 2.1 Invoice/CreditNote or UN/CEFACT CII, e.g. XRechnung, Factur-X/ZUGFeRD XML) against the official CEN EN 16931 rules and, for XRechnung, the KoSIT XRechnung 3.0 rules. Returns valid, and every error with its rule ID (e.g. BR-CO-10), a plain-English message, XPath and a fix hint. rules: auto | en16931 | xrechnung. Slovak sellers also get eFaktúra field checks (FR SR transposition v1.13, warnings with ruleset SK-FS); Norwegian sellers get NO-LAW field checks. Peppol-specific rules are not checked yet. For PDFs use the REST endpoint POST /einvoice/validate. fixes lists concrete fixes for the errors (path, current, suggested, explanation, apply safe|amounts|manual). autofix=true applies the safe ones to a copy and returns it in autofix.xml with its new result (the original is unchanged); allow_amount_changes=true also applies total fixes that change the amount due (reported).

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": {
      "xml": "<xml>"
    },
    "name": "validate_einvoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
xmlYesThe e-invoice XML as text: UBL 2.1 Invoice/CreditNote or UN/CEFACT CII (XRechnung, Factur-X/ZUGFeRD XML).
rulesNoRule set: 'auto' (detect from the invoice, default), 'en16931' or 'xrechnung'.auto
autofixNoIf true, apply the safe fixes to a copy and return the fixed XML in autofix.xml (the input is never changed).
allow_amount_changesNoIf true together with autofix, also apply fixes that change amounts (e.g. recomputed totals).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • addedInput schema / properties / allow_amount_changes / description
      Added value: +"If true together with autofix, also apply fixes that change amounts (e.g. recomputed totals)."
    • addedInput schema / properties / autofix / description
      Added value: +"If true, apply the safe fixes to a copy and return the fixed XML in autofix.xml (the input is never changed)."
    • addedInput schema / properties / rules / description
      Added value: +"Rule set: 'auto' (detect from the invoice, default), 'en16931' or 'xrechnung'."
    • addedInput schema / properties / xml / description
      Added value: +"The e-invoice XML as text: UBL 2.1 Invoice/CreditNote or UN/CEFACT CII (XRechnung, Factur-X/ZUGFeRD XML)."
  2. Changed2 schema fields changed
    • addedInput schema / properties / allow_amount_changes
      Added value: +{
      +  "default": false,
      +  "title": "Allow Amount Changes",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / autofix
      Added value: +{
      +  "default": false,
      +  "title": "Autofix",
      +  "type": "boolean"
      +}
  3. First observed

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnly/idempotent/non-destructive, and the description adds the substantive behavior: per-error rule IDs, messages, XPath and fix hints, the SK-FS and NO-LAW jurisdictional checks, the explicit Peppol gap, and the autofix contract (applied to a copy, original unchanged, returned as autofix.xml). The autofix processing is consistent with the non-destructive 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?

Front-loaded with the core verb and standards, then progressively discloses results, jurisdictional extras and autofix. Some clauses are crammed together (the rules enum restated mid-sentence, the fixes/autofix narrative running on), but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description carries the return-value burden and does so reasonably: valid flag, error fields, fixes structure with apply modes, and autofix.xml. It stops short of describing the overall response envelope or behavior on malformed/non-e-invoice input.

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; the description earns more by explaining what autofix actually returns (autofix.xml with a new result) and clarifying that allow_amount_changes applies total fixes that alter the amount due and are reported. The rest (xml, rules) is largely duplicated from the schema.

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?

Names a specific verb (validate) and resource (EU e-invoice XML) and pins the standards: CEN EN 16931, XRechnung 3.0 (KoSIT), UBL 2.1 Invoice/CreditNote and UN/CEFACT CII. The format scope (XML only, PDFs go to the REST endpoint) separates it cleanly from parse_einvoice and the other siblings.

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?

Explicitly routes PDF input away to 'POST /einvoice/validate', which is a real when-not clause, and explains the rules selector values. It does not say when to prefer parse_einvoice or create_einvoice, so an agent gets context but no full alternative mapping.

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.