Skip to main content
Glama

ANAF e-Factura

Build a CIUS-RO invoice

build_invoice
Read-onlyIdempotent

Write 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

NameRequiredDescriptionDefault
buyerYesThe buyer.
linesYes
notesNo
numberYesThe invoice number, series included; it must contain a digit.
sellerYesThe seller: your company.
paymentNo
currencyNoISO 4217, RON by default.RON
due_dateNoWhen payment is due; an amount due needs this or payment terms.
file_nameNoThe file's name, in the outbox or as attached to the answer; by default the invoice number's.
type_codeNo380 invoice (default), 384 corrected, 389 self-billed, 751 for accounting.380
issue_dateYes
delivery_dateNo
invoice_periodNo
vat_exemptionsNoWhy 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_referenceNo
order_referenceNo
preceding_invoiceNoThe invoice this one corrects or reverses.
vat_exchange_rateNoFor 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_referenceNo

Output Schema

NameRequiredDescriptionDefault
nameNoThe attached file's name
noteNo
pathNoThe 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
bytesYes
externNoThe buyer is not Romanian: upload it with extern: true
inlineNoThe file is attached to the answer, not saved anywhere
sha256Yes
totalsYes
invoiceYesThe file read back the way upload_invoice reads it for its confirmation line

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Adds substantial behavior beyond the annotations: the draft is validated first (CIF/CNP/IBAN check digits, county/sector, VAT rules per category, length limits), all problems reported at once, and the result is an attached XML plus sha256 and totals with no server-side copy. Rounding behavior (per-line 2 decimals, VAT once per category and rate) is a genuine disclosure. The only soft spot is the tension between readOnlyHint=true and a 'write' verb, which the 'keeps no copy / nothing sent to ANAF' sentence is needed to resolve.

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?

Purpose and inputs come first, then validation behavior, then output and constraints, so it is well front-loaded. It is dense and the sentence on checks is a long list, but nearly every clause carries information an agent needs.

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?

For a 19-parameter, deeply nested builder this covers the decisions that matter: required parties and lines, validation order, rounding, currency handling, and what comes back. Since an output schema exists it need not explain return values, and the remaining optional fields are documented in the schema itself.

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

Parameters4/5

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

With schema coverage at 53% across 19 parameters, the description usefully supplies meaning the schema leaves thin: lines must carry NET price, quantity and VAT category; vat_exchange_rate is RON per unit of the invoice currency and forces VAT to also be stated in RON. It does not touch due_date, type_code, notes or the exchange-rate interplay with totals, but the added semantics are real rather than restated 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?

States a specific verb and artifact: writes a Romanian e-Factura invoice in UBL 2.1 / CIUS-RO, built from seller, buyer, lines, currency and payment terms. That clearly separates it from the siblings (parse_invoice, validate_invoice, invoice_pdf) which read, check or render rather than build.

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?

It gives conditional rules ('an invoice in another currency needs vat_exchange_rate'), and rules out ANAF submission, which is useful context. But it never names an alternative or says when to prefer invoice_pdf or validate_invoice, so an agent must infer the workflow split from sibling names alone.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.