Skip to main content
Glama
cmendezs

mcp-fattura-elettronica-it

generate_fattura_xml

Assemble prepared blocks into a complete FatturaPA v1.2.3 XML document for Italian e-invoicing. Returns the final XML string, filename, and transmission format, ready for XSD validation.

Instructions

Assemble a complete FatturaPA v1.2.3 XML document from all prepared blocks.

Use this as step 10 in the invoice generation workflow — the final assembly step. All required blocks must come from their respective builder/validator tools; pass the full dict returned by each tool (the function unwraps the top-level key).

Required: dati_trasmissione, cedente_prestatore, cessionario_committente, dati_generali, dettaglio_linee (list), dati_riepilogo (list from compute_totali()). Optional: dati_pagamento, allegati (list), dati_ritenuta.

Does NOT validate against the XSD schema — call validate_fattura_xsd() (step 11) on the returned 'xml' string immediately after to confirm conformance.

On success returns {'xml': str, 'filename': str, 'formato_trasmissione': str, 'length_bytes': int}. On unexpected error returns {'error': ''}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allegatiNoList of Allegati dicts from add_allegato(). Optional.
dati_generaliYesDatiGenerali block from build_dati_generali(). Contains document type, date, number, and currency.
dati_ritenutaNoDatiRitenuta block from check_ritenuta_acconto(). Required for professional invoices with withholding tax (ritenuta d'acconto).
dati_pagamentoNoDatiPagamento block from build_dati_pagamento(). Optional.
dati_riepilogoYesList of DatiRiepilogo dicts from compute_totali(). Contains VAT summary grouped by AliquotaIVA.
dettaglio_lineeYesList of DettaglioLinee dicts from add_linea_dettaglio(). Each entry must have NumeroLinea, Descrizione, PrezzoUnitario, PrezzoTotale, and AliquotaIVA.
additional_bodiesNoAdditional FatturaElettronicaBody blocks for FPA12 batch invoicing. Each entry is a dict with keys: dati_generali, dettaglio_linee, dati_riepilogo, and optionally dati_pagamento, allegati, dati_ritenuta. Only valid for FPA12 (B2G) transmissions; FPR12 does not support batching.
dati_trasmissioneYesDatiTrasmissione block from build_transmission_header(). Must contain IdTrasmittente, ProgressivoInvio, FormatoTrasmissione, and CodiceDestinatario.
cedente_prestatoreYesCedentePrestatore block from validate_cedente_prestatore(). Contains seller's tax ID, name, address, and fiscal regime.
cessionario_committenteYesCessionarioCommittente block from validate_cessionario(). Contains buyer's tax ID, name, and address.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It is transparent about the non-validating behavior, the required top-level dict unwrapping convention, and the exact success and error return shapes, which is exactly the information an agent needs to handle this tool correctly.

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?

The description is front-loaded with the core action and workflow position, followed by a concise breakdown of required, optional, and validation behavior. It contains no filler: every sentence covers a decision-relevant aspect such as prerequisites, return values, or the next step.

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?

Given the tool's complexity, the description covers provenance of all inputs, required vs optional parameters, the non-validation caveat, the downstream validation step, and both success and error return contracts. The schema carries the remaining per-block constraints, including the FPA12 batching limitation, so nothing critical for correct invocation is missing.

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?

The input schema already provides detailed descriptions for all parameters, and the schema descriptions include the source builder/validator tool for each block. The description adds the key convention that the caller must pass the full dict returned by each tool and that the function unwraps the top-level key, though individual parameter format details still live mostly in 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?

The opening sentence names a specific verb and resource: it assembles a complete FatturaPA v1.2.3 XML document from prepared blocks. It also clearly differentiates this from the validation tool by stating that it does NOT validate against the XSD schema, so an agent can immediately tell assembly from validation.

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?

The description explicitly positions this as step 10 in the invoice generation workflow, requires inputs from the specific builder/validator tools, and tells the agent to call validate_fattura_xsd() as step 11. It lacks explicit routing away from sibling generators such as generate_fattura_semplificata or the UBL/CII tools, but the workflow framing still gives clear context.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmendezs/mcp-fattura-elettronica-it'

If you have feedback or need assistance with the MCP directory API, please join our Discord server