Skip to main content
Glama

Imperio — Italian Tax & Compliance Tools

FatturaPA: parse + supplier anti-fraud check

parse_verify_fatturapa
Read-onlyIdempotent

Extracts structured data from a FatturaPA/SDI XML e-invoice AND, in the same call, runs an anti-fraud check on the chosen party (default: the CEDENTE, i.e. the supplier who receives the bank transfer). The checked data are NOT inferred by an LLM: VAT number, Codice Fiscale, company name and payment IBAN are extracted deterministically from the XML, then passed to the checks: IBAN (MOD-97 checksum + bank from the ABI code), VAT number and CF (checksum) and — when the EU service is reachable — the real registered name via live VIES, compared with the one stated on the invoice. Returns the full parse plus supplier_verification with a verdict (ok / non_verificabile / attenzione / alto_rischio = ok / not verifiable / caution / high risk) and specific red flags; if the invoice carries several distinct IBANs it flags it and lowers the verdict. It is the defence against the IBAN-change fraud on incoming invoices. Like verify_payee it performs external I/O (a single VIES query per call, not one per line): if VIES is down or the shared budget is exhausted the verdict degrades HONESTLY to "attenzione", never to a false "ok". It does NOT replace out-of-band verification (a phone call to the supplier on an already known number).

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_content": "<xml_content>"
    },
    "name": "parse_verify_fatturapa"
  }
}

Input Schema

NameRequiredDescriptionDefault
partyNoParty to check: 'cedente' = supplier/payee (default, the anti-fraud case); 'cessionario' = customer. The IBAN is collected only for the cedente, because the cedente is the one who gets paid.cedente
xml_contentYesThe XML content of the electronic invoice (FatturaPA/SDI). A .p7m must be unwrapped first: plain-text XML only.
expected_countryNoExpected supplier country, ISO2. If omitted, the country stated by the invoice itself (the cedente's seat) applies, and only failing that 'IT'. A foreign IBAN on a supplier expected to be Italian is fraud warning sign #1.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / expected_country / description
      Previous value: -"Paese atteso del fornitore in ISO2. Se omesso vale il paese dichiarato dalla fattura stessa (sede del cedente), e solo in sua mancanza 'IT'. Un IBAN estero su un fornitore atteso italiano è il campanello #1 della frode."New value: +"Expected supplier country, ISO2. If omitted, the country stated by the invoice itself (the cedente's seat) applies, and only failing that 'IT'. A foreign IBAN on a supplier expected to be Italian is fraud warning sign #1."
    • changedInput schema / properties / party / description
      Previous value: -"Parte da verificare: 'cedente' = fornitore/chi riceve il pagamento (default, il caso anti-frode); 'cessionario' = cliente. L'IBAN viene raccolto solo per il cedente, perché è lui che incassa."New value: +"Party to check: 'cedente' = supplier/payee (default, the anti-fraud case); 'cessionario' = customer. The IBAN is collected only for the cedente, because the cedente is the one who gets paid."
    • changedInput schema / properties / xml_content / description
      Previous value: -"Il contenuto XML della fattura elettronica (FatturaPA/SDI). Il .p7m va scompattato prima: qui si accetta XML testuale."New value: +"The XML content of the electronic invoice (FatturaPA/SDI). A .p7m must be unwrapped first: plain-text XML only."
  2. Changed2 schema fields changed
    • removedInput schema / properties / expected_country / default
      Removed value: -"IT"
    • changedInput schema / properties / expected_country / description
      Previous value: -"Paese atteso del fornitore in ISO2. Un IBAN estero su un fornitore atteso italiano è il campanello #1 della frode."New value: +"Paese atteso del fornitore in ISO2. Se omesso vale il paese dichiarato dalla fattura stessa (sede del cedente), e solo in sua mancanza 'IT'. Un IBAN estero su un fornitore atteso italiano è il campanello #1 della frode."
  3. Added

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, openWorld), and the description adds substantial context beyond them: determinism (data extracted from XML, not inferred by an LLM), exactly one VIES query per call rather than per line, honest degradation to 'attenzione' when VIES is down or the shared budget is exhausted, and flagging of multiple distinct IBANs. It also discloses the output field `supplier_verification` and its four verdict levels.

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 core function and the party default are front-loaded, and the later sentences carry real weight (VIES budget behaviour, non-replacement of out-of-band checks). It is still dense with parenthetical glosses and bilingual verdict labels that could be tightened without losing information.

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 an output schema absent but a rich return contract, the description explains the returned artifact and verdict vocabulary, the failure/degradation path, and the boundary of what it can prove. Nothing an agent needs to invoke it correctly or interpret ambiguous results is missing.

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 baseline is 3: the schema already explains `party`, the plain-XML requirement for `xml_content`, and the ISO2 fallback logic for `expected_country`. The description restates the party default and the rationale for IBAN collection but adds no format, syntax, or edge-case detail the schema does not already carry.

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 compound verb and resource ('Extracts structured data from a FatturaPA/SDI XML e-invoice AND ... runs an anti-fraud check'), names the default target (the cedente), and explicitly positions itself against the sibling `verify_payee` on the external-I/O dimension. An agent can distinguish it from a parse-only tool 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 Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives a clear use case ('the defence against the IBAN-change fraud on incoming invoices') and an explicit exclusion ('does NOT replace out-of-band verification ... a phone call to the supplier'). It lacks an explicit routing statement such as 'use parse_fatturapa when you only need the data' or 'use verify_payee when you already hold the IBAN', so the alternative selection is only implied.

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