Skip to main content
Glama
cmendezs

mcp-fattura-elettronica-it

Build Transmission Header

build_transmission_header

Builds and validates the DatiTrasmissione block for a FatturaPA header, checking format, recipient code, and PEC requirements before XML generation.

Instructions

Build the DatiTrasmissione block required in every FatturaPA header.

Use this as step 3 in the invoice generation workflow, after generate_progressivo_invio() and before validate_cedente_prestatore(). Use lookup_codice_destinatario() first to confirm the recipient code format.

Validates: formato_trasmissione must be 'FPA12' or 'FPR12'; progressivo_invio must be 1–10 alphanumeric characters; pec_destinatario is required when codice_destinatario is '0000000'.

On success returns {'DatiTrasmissione': {...}} ready to pass to generate_fattura_xml(). On failure returns {'error': ''} — do not proceed to XML generation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
id_paeseYesTwo-letter ISO 3166-1 country code of the transmitter (e.g. 'IT'). Usually 'IT' for Italian entities.
id_codiceYesTax identifier of the transmitter: Partita IVA (11 digits) for Italian entities, or foreign tax ID (max 28 chars) for cross-border.
pec_destinatarioNoPEC (certified email) address of the recipient. Required only when codice_destinatario is '0000000'.
progressivo_invioYesUnique sequential send identifier, max 10 alphanumeric characters. Use generate_progressivo_invio() to obtain one automatically.
codice_destinatarioYesSDI recipient code: 6-char for PA offices (IPA code, FPA12), 7-char for B2B intermediaries (FPR12), or '0000000' (7 zeros) for PEC routing. Use lookup_codice_destinatario() to validate the code first.
formato_trasmissioneYesTransmission format: 'FPA12' for invoices to Public Administration (PA), 'FPR12' for invoices to private parties (B2B / B2C).

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.4
    • changedInput schema / properties / codice_destinatario / description
      Previous value: -"6-character alphanumeric SDI recipient code assigned to the buyer's intermediary. Use '0000000' (7 zeros) when routing via PEC email instead."New value: +"SDI recipient code: 6-char for PA offices (IPA code, FPA12), 7-char for B2B intermediaries (FPR12), or '0000000' (7 zeros) for PEC routing. Use lookup_codice_destinatario() to validate the code first."
  2. First observedv0.2.0

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description carries the full burden, and it delivers: it discloses the validation rules (formato_trasmissione allowed values, progressivo_invio constraints, conditional pec_destinatario requirement) and the success/failure return shapes. Minor gap: it doesn't explicitly state that this is a pure in-memory builder with no persistence or external side effects, though 'Build' implies it.

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 tightly organized: purpose, workflow placement, validation rules, and return behavior. Every sentence earns its place, and the critical workflow ordering is front-loaded.

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 6-parameter builder with an output schema, this fully equips the agent: workflow position, validation expectations, error handling, and return contract are all present. The output schema covers structured return details, while the description adds the behavioral context around when and how to invoke the tool.

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 baseline is 3. The description adds value by spelling out validation constraints (e.g., formato_trasmissione must be 'FPA12' or 'FPR12'; progressivo_invio 1–10 alphanumeric; pec_destinatario required when codice_destinatario is '0000000') and by linking parameters to sibling tools like generate_progressivo_invio and lookup_codice_destinatario.

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 verb ('Build') and resource ('DatiTrasmissione block required in every FatturaPA header'). Clearly distinguishes itself from siblings by naming its place in the workflow and its relationship to generate_progressivo_invio, validate_cedente_prestatore, and generate_fattura_xml.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

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

Explicitly positions this tool as step 3 in the invoice generation workflow, with direct predecessor and successor tools named. Also instructs to call lookup_codice_destinatario() first and to stop on failure, giving concrete when-to-use and when-not-to-continue guidance.

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