Skip to main content
Glama
cmendezs

mcp-fattura-elettronica-it

Add Linea Dettaglio

add_linea_dettaglio

Create a single line item (DettaglioLinee) for an Italian e-invoice body. Specify product details, VAT rate, and optional exemptions to step 7 of the workflow, then pass the result to compute_totali().

Instructions

Build a single DettaglioLinee (line item) entry for the FatturaElettronicaBody.

Use this as step 7 in the invoice generation workflow — call once per line item after build_dati_generali(). Collect all returned dicts into a list and pass it to compute_totali() (step 8) and then generate_fattura_xml() (step 10).

numero_linea must be sequential starting at 1; do not reuse numbers in the same invoice. prezzo_totale must be provided explicitly (not computed); use negative values for credit notes. When aliquota_iva is 0.0, natura is required — call get_natura_codes() to select the code. Set ritenuta='SI' on lines subject to withholding tax and include the DatiRitenuta block from check_ritenuta_acconto() when generating XML. altri_dati_gestionali (optional): structured management data entries, emitted after Natura in the XSD element order. See build_sport_worker_exemption_dato_gestionale() for the codifica introduced by Specifiche Tecniche 1.9.1.

On success returns {'DettaglioLinee': {...}}, plus 'warnings' (list[str]) when aliquota_iva is a non-standard IT VAT rate (outside 4, 5, 10, 22). On failure returns {'error': ''}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
naturaNoNatura exemption code: N1, N2.1, N2.2, N3.1–N3.6, N4, N5, N6.1–N6.9, N7. Parent codes N2, N3, N6 are invalid since Jan 2021 and are not accepted. Required when aliquota_iva is 0.0. Use get_natura_codes() for the full list.
quantitaNoQuantity (Quantita). Optional for services billed as a lump sum. When provided, unit_price × quantita should equal prezzo_totale.
ritenutaNoWithholding tax flag: 'SI' to indicate that this line is subject to ritenuta d'acconto. Use check_ritenuta_acconto() to compute the amount.
descrizioneYesDescription of the good or service (max 1000 chars).
aliquota_ivaNoVAT rate as a percentage (e.g. 22.0 for 22%, 10.0 for 10%, 0.0 for exempt). Use 0.0 together with a Natura code for exempt/out-of-scope supplies.
numero_lineaYesSequential line number starting at 1. Each DettaglioLinee entry must have a unique NumeroLinea.
unita_misuraNoUnit of measure (e.g. 'PZ', 'KG', 'ORE', 'M2'). Optional.
prezzo_totaleNoTotal line amount before VAT (PrezzoTotale = quantita × prezzo_unitario). Must be provided explicitly; the tool does not auto-compute it.
prezzo_unitarioNoUnit price before VAT (PrezzoUnitario). Negative for credit notes.
altri_dati_gestionaliNoOptional list of AltriDatiGestionali entries (DettaglioLinee, XSD maxOccurs unbounded). Each entry is a dict with XSD-cased keys: 'TipoDato' (str, required, max 10 chars), 'RiferimentoTesto' (str, optional, max 60 chars), 'RiferimentoNumero' (str/float, optional), 'RiferimentoData' (str YYYY-MM-DD, optional) — the same shape returned by build_sport_worker_exemption_dato_gestionale()['AltriDatiGestionali'], which can be passed straight through in this list for the sport-worker IRPEF exemption codifica ('ESENZSPORT').

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.7.0
    • addedInput schema / properties / altri_dati_gestionali
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "additionalProperties": true,
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Optional list of AltriDatiGestionali entries (DettaglioLinee, XSD maxOccurs unbounded). Each entry is a dict with XSD-cased keys: 'TipoDato' (str, required, max 10 chars), 'RiferimentoTesto' (str, optional, max 60 chars), 'RiferimentoNumero' (str/float, optional), 'RiferimentoData' (str YYYY-MM-DD, optional) — the same shape returned by build_sport_worker_exemption_dato_gestionale()['AltriDatiGestionali'], which can be passed straight through in this list for the sport-worker IRPEF exemption codifica ('ESENZSPORT')."
      +}
  2. Changed1 schema field changedv0.2.4
    • changedInput schema / properties / natura / description
      Previous value: -"Natura exemption code (N1–N7, N2.1, N2.2, N3.1–N3.6, N6.1–N6.9, N7). Required when aliquota_iva is 0.0. Use get_natura_codes() for the full list."New value: +"Natura exemption code: N1, N2.1, N2.2, N3.1–N3.6, N4, N5, N6.1–N6.9, N7. Parent codes N2, N3, N6 are invalid since Jan 2021 and are not accepted. Required when aliquota_iva is 0.0. Use get_natura_codes() for the full list."
  3. First observedv0.2.0

TDQS

A5/5.0
Behavior5/5

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

With no annotations provided, the description carries full burden. It discloses that prezzo_totale must be provided explicitly (not computed), that negative values are used for credit notes, that natura is required when aliquota_iva is 0.0, that warnings are returned for non-standard VAT rates, and that altri_dati_gestionali entries are emitted after Natura in XSD element order. It also specifies success and failure return shapes. No important behavioral trait is left hidden.

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 long but exceptionally dense and well-structured. It front-loads the purpose and workflow position, then sequences constraints (numero_linea, prezzo_totale, natura), then optional data, then return behavior. Every sentence conveys a directive or constraint; there is no filler or redundancy. The length is justified by the complexity of the tool.

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 10-parameter, 2-required tool with no annotations, this description is complete. It provides full workflow context, exact dependencies on sibling tools (get_natura_codes, check_ritenuta_acconto, build_sport_worker_exemption_dato_gestionale), instructions for handling the output (collect into a list for compute_totali), and details on error and warning returns. Nothing essential for correct invocation is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 100% schema description coverage, the description adds significant meaning beyond the schema: numero_linea must be sequential starting at 1 and not reused; prezzo_totale is not auto-computed; negative values indicate credit notes; the requirement to use get_natura_codes() for natura selection; and the detailed structure of altri_dati_gestionali with a pointer to build_sport_worker_exemption_dato_gestionale() for the 1.9.1 codifica. These are crucial semantic cues an agent cannot derive from the schema alone.

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 description clearly states the verb 'Build' and the resource 'a single DettaglioLinee (line item) entry for the FatturaElettronicaBody,' and immediately places it as step 7 in the invoice generation workflow. This distinguishes it from sibling build_* tools such as build_dati_generali and compute_totali. No ambiguity about what this tool does.

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 instructs 'Use this as step 7' and gives the exact sequence: after build_dati_generali(), collect the returned dicts into a list, pass to compute_totali() (step 8) and then generate_fattura_xml() (step 10). It also specifies 'call once per line item' and directs when to invoke helper tools like get_natura_codes() and check_ritenuta_acconto() under specific conditions. This is textbook usage guidance.

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