Skip to main content
Glama
cmendezs

mcp-fattura-elettronica-it

Parse Fattura Xml

parse_fattura_xml

Parse FatturaPA XML (FPR12/FPA12) into a structured Python dict to inspect or process invoices. Extracts header, body, line items, and payment data; returns errors on invalid XML.

Instructions

Parse a FatturaPA XML string into a structured Python dict.

Use this to inspect or process invoices received from counterparties, or to verify the output of generate_fattura_xml(). Accepts both FPR12 (B2B) and FPA12 (PA) formats. The result can be passed directly to export_to_json().

Extracts: versione, transmission data, seller/buyer identity and address, document type/date/number/causale, all DettaglioLinee, DatiRiepilogo, and DatiPagamento if present. Fields not found in the XML are returned as null.

On success returns {'versione': str, 'header': {...}, 'body': {...}}. On XML parse error returns {'error': 'XML parse error: '}. On missing lxml returns {'error': 'lxml is not installed...'}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
xml_stringYesFatturaPA XML string to parse. Accepts both single-invoice (FPR12) and PA-addressed (FPA12) formats.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A3.9/5.0
Behavior4/5

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

No annotations are provided, so the description fully discloses behavior. It lists exact extracted fields, states that missing fields become null, and documents both success and error return formats—more than typical.

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?

Well-structured with a purpose sentence, usage context, extracted fields list, and return format—all in under 150 words. It is front-loaded with the main verb and resource. Minor redundancy with ''Parse'' in both name and first line.

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?

Given an output schema exists, it need not explain return values, but it still documents error cases. With only one parameter fully documented, the description thoroughly covers what the tool does, extracted fields, and error handling. It could mention limits on XML size or complexity, but not critical for a parse tool.

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 covers 100% of the single parameter, so baseline is 3. The description adds that it accepts two formats and that the string is 'FatturaPA XML', which slightly extends but doesn't add syntax details beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a clear verb ('Parse') and resource (FatturaPA XML into Python dict). Distinguishes between FPR12 and FPA12 formats, and references related sibling tools (generate_fattura_xml, export_to_json). It does not explicitly name a sibling like parse_fattura_semplificata_xml for differentiation, but the specificity is high.

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 states when to use: to inspect/process invoices and verify generated output. It does not state when NOT to use (e.g., for simplified invoices) or mention alternatives like parse_fattura_semplificata_xml. Provides context but lacks exclusions.

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