generate_invoice
Generate ZATCA-compliant UBL 2.1 XML e-invoices for Saudi Arabia. Supports standard, simplified, credit note, and debit note types with automatic VAT calculation and QR code data.
Instructions
Generate a ZATCA-compliant UBL 2.1 XML e-invoice.
Creates a complete XML invoice following Saudi Arabia's ZATCA e-invoicing standard. Supports Standard (B2B), Simplified (B2C), Credit Note, and Debit Note invoice types. Automatically calculates VAT, line totals, and embeds QR code data.
Args: invoice_type: "standard" (B2B), "simplified" (B2C), "credit_note", or "debit_note" invoice_number: Unique invoice identifier (e.g., "INV-2024-001") issue_date: Invoice date in YYYY-MM-DD format seller_name: Seller business name seller_vat: Seller 15-digit VAT number (e.g., "300000000000003") seller_address: Seller street address seller_city: Seller city name buyer_name: Buyer/customer name items: JSON array of line items. Each item: {"name": "Product", "quantity": 1, "unit_price": 100.00, "vat_rate": 0.15} currency: ISO currency code (default: "SAR") buyer_vat: Buyer VAT number (required for standard invoices) buyer_address: Buyer street address (optional) buyer_city: Buyer city (optional) note: Optional note to include on the invoice billing_reference_id: Original invoice ID (required for credit/debit notes) billing_reference_date: Original invoice date (for credit/debit notes) instruction_note: Reason for credit/debit note (recommended)
Returns: Complete UBL 2.1 XML invoice string
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"invoice_type": "<invoice_type>",
"invoice_number": "<invoice_number>",
"issue_date": "<issue_date>",
"seller_name": "<seller_name>",
"seller_vat": "<seller_vat>",
"seller_address": "<seller_address>",
"seller_city": "<seller_city>",
"buyer_name": "<buyer_name>",
"items": "<items>"
},
"name": "generate_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| items | Yes | ||
| currency | No | SAR | |
| buyer_vat | No | ||
| buyer_city | No | ||
| buyer_name | Yes | ||
| issue_date | Yes | ||
| seller_vat | Yes | ||
| seller_city | Yes | ||
| seller_name | Yes | ||
| invoice_type | Yes | ||
| buyer_address | No | ||
| invoice_number | Yes | ||
| seller_address | Yes | ||
| instruction_note | No | ||
| billing_reference_id | No | ||
| billing_reference_date | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |