Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNo
itemsYes
currencyNoSAR
buyer_vatNo
buyer_cityNo
buyer_nameYes
issue_dateYes
seller_vatYes
seller_cityYes
seller_nameYes
invoice_typeYes
buyer_addressNo
invoice_numberYes
seller_addressYes
instruction_noteNo
billing_reference_idNo
billing_reference_dateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries full burden. It discloses that the tool automatically calculates VAT, embeds QR code data, and returns an XML string. This provides good insight into behavior, though it omits details like error handling or performance characteristics.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a summary paragraph followed by an argument list. While lengthy, it is justified by the tool's complexity (17 parameters). The main purpose is front-loaded, but some redundant phrasing ('Creates a complete XML invoice') could be trimmed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity, schema, and output schema, the description covers all parameters and the return type. It does not explain potential errors or edge cases, but for an AI agent generating invoices, the instructions are sufficient. The existence of an output schema mitigates the need for detailed output description.

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?

Schema coverage is 0%, so the description must compensate. It does so excellently by providing detailed explanations of all 17 parameters, including examples, types, and required conditions (e.g., 'buyer_vat' required for standard invoices). This adds significant meaning beyond the bare 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 description clearly states it 'Generate a ZATCA-compliant UBL 2.1 XML e-invoice' and lists supported invoice types (Standard, Simplified, Credit Note, Debit Note). This specific verb+resource combination distinguishes it from sibling tools like generate_qr_code, validate_invoice, etc.

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

Usage Guidelines3/5

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

The description implies it's for creating invoices but does not explicitly state when to use it versus alternatives (e.g., for signing or submitting, use other tools). No when-not or exclusion criteria are provided, leaving the agent to infer usage from 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/DoubleH10/zatca-mcp'

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