Build a CIUS-RO invoice
build_invoiceWrite a Romanian e-Factura invoice (UBL 2.1, CIUS-RO) from fields: seller and buyer, lines with their net price, quantity and VAT category, the currency, the payment terms. Totals are computed exactly (each line rounded to 2 decimals, VAT once per category and rate), and the draft is checked first: CIF, CNP and IBAN check digits, the county and Bucharest sector, the VAT rules per category, CIUS-RO's lengths, every problem named at once. The XML is attached to the answer as a file, with its sha256 and the totals in the answer; this server keeps no copy. Nothing is sent to ANAF. An invoice in another currency needs vat_exchange_rate (RON per unit), so its VAT is stated in RON too.
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": {
"number": "<number>",
"issue_date": "<issue_date>",
"seller": "<seller>",
"buyer": "<buyer>",
"lines": "<lines>"
},
"name": "build_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buyer | Yes | The buyer. | |
| lines | Yes | ||
| notes | No | ||
| number | Yes | The invoice number, series included; it must contain a digit. | |
| seller | Yes | The seller: your company. | |
| payment | No | ||
| currency | No | ISO 4217, RON by default. | RON |
| due_date | No | When payment is due; an amount due needs this or payment terms. | |
| file_name | No | The file's name, in the outbox or as attached to the answer; by default the invoice number's. | |
| type_code | No | 380 invoice (default), 384 corrected, 389 self-billed, 751 for accounting. | 380 |
| issue_date | Yes | ||
| delivery_date | No | ||
| invoice_period | No | ||
| vat_exemptions | No | Why a category carries no VAT: required for E (a VATEX-EU code or the law's words); AE, G and O default to VATEX-EU-AE, -G, -O. | |
| buyer_reference | No | ||
| order_reference | No | ||
| preceding_invoice | No | The invoice this one corrects or reverses. | |
| vat_exchange_rate | No | For an invoice not in RON, required: RON for one unit of its currency (bnr's rate); the VAT is then also stated in RON. | |
| contract_reference | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | The attached file's name | |
| note | No | ||
| path | No | The built file in the outbox: give it to validate_invoice and upload_invoice as xml: { path }. Absent when the file is attached to the answer instead | |
| bytes | Yes | ||
| extern | No | The buyer is not Romanian: upload it with extern: true | |
| inline | No | The file is attached to the answer, not saved anywhere | |
| sha256 | Yes | ||
| totals | Yes | ||
| invoice | Yes | The file read back the way upload_invoice reads it for its confirmation line |