generate_invoice_report
Aggregate batches of FatturaPA XML invoices into a structured report with totals, supplier/customer breakdowns, and anomaly summaries, while isolating unparseable documents.
Instructions
Aggregate a batch of FatturaPA XML documents into a structured report.
Processes each invoice through extract_invoice_data and find_invoice_anomalies, then aggregates the results into totals, supplier/customer breakdowns, and an anomaly summary. Documents that cannot be parsed are counted separately in the errors list; they do not affect the monetary totals. Never logs or persists XML content.
Progress notifications: one step per invoice (1..N), then a final step (N+1) for the aggregation phase.
Args:
xml_contents: List of raw FatturaPA XML strings to process.
title: Optional report title; defaults to "Invoice Report".
ctx: Optional MCP context for structured log emission.
Returns: An InvoiceReportResult TypedDict with aggregated statistics, party breakdowns (suppliers/customers), and an anomaly summary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | ||
| xml_contents | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | ||
| errors | Yes | ||
| currency | Yes | ||
| customers | Yes | ||
| suppliers | Yes | ||
| total_vat | Yes | ||
| generated_at | Yes | ||
| total_amount | Yes | ||
| total_invoices | Yes | ||
| valid_invoices | Yes | ||
| invalid_invoices | Yes | ||
| anomalies_summary | Yes |