Validate an e-invoice
validate_invoiceChecks an e-invoice XML or Factur-X/ZUGFeRD PDF against official XSD, EN 16931 Schematron and XRechnung or Peppol rules offline, reporting each failed rule before you send or accept it.
Instructions
Checks an e-invoice against the official rule sets on this machine: the XSD, the EN 16931 Schematron from CEN, and the KoSIT XRechnung or Peppol BIS rules when the document declares them. Use it before sending an invoice you created and when you receive one. To read the invoice's data use parse_invoice; to explain one failed rule in depth use explain_validation_rule. Accepts XML or a Factur-X / ZUGFeRD PDF, whose embedded XML is checked; syntax and profile are detected from the document. A valid result means the listed ruleSets passed, not that a tax authority or buyer will accept the invoice, so report which rule sets ran and never claim more. Each failure carries the publisher's message and, for common rules, a plain-language fix. Input that is not an invoice comes back as an error result, not as invalid. The check runs offline; nothing is uploaded.
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"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xml | No | The invoice as XML text (CII, UBL Invoice/CreditNote, XRechnung, Peppol BIS). Provide this OR pdfBase64. | |
| xsd | No | Run XSD validation too. Default true. | |
| country | No | Add a country layer: "FR" runs the French CTC rules (CII only); "DE" reports whether the profile is acceptable for German B2B (MINIMUM and BASIC WL are not). | |
| profile | No | Force the rule set instead of reading it from BT-24. | |
| pdfBase64 | No | A Factur-X / ZUGFeRD PDF/A-3 as base64; the embedded XML is used. Provide this OR xml. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| xsd | Yes | XML Schema check. | |
| valid | Yes | True only when no error-level rule failed, the XSD did not fail, and no error-level notice was raised. | |
| origin | Yes | Whether the input was XML or a PDF. | |
| notices | Yes | Findings about the document that are not Schematron rules, e.g. an unrecognised profile, or (with country DE) a profile not acceptable for German B2B. An error-level notice makes valid false. | |
| detected | Yes | What the document declares about itself. | |
| failures | Yes | Error-level rules that failed; any entry makes valid false. | |
| ruleSets | Yes | Exactly the rule sets that ran. Report these; do not claim checks that are not listed. | |
| advisories | Yes | Warning or info rules that fired; they do not make the invoice invalid. | |
| firedCount | Yes | Schematron rules that fired across all rule sets. | |
| embeddedFilename | No | PDF only: name of the embedded XML that was checked. |