Skip to main content
Glama
ucetka-mcp

ucetka-mcp

Issue invoice (PDF + ISDOC)

issue_invoice

Creates a new invoice: renders a PDF/A-3a with an embedded ISDOC e-invoice and QR payment code, saves it and records it in the ledger. Use it to bill a customer in one step.

Instructions

Issue a new invoice: render a PDF/A-3a with an embedded ISDOC 6.0.2 e-invoice and a QR Platba+F payment code, save it and record it in the ledger. Returns a summary: PDF path, number, items, totals, due date and variable symbol.

Side effects: writes ~/Documents/Účetnictví/Vydané faktury/<YY_MM_vydane>/faktura_.pdf (folder by DUZP, tax point date) and ~/.ucetka/invoices/.json; calls ARES when customer_ico is used and the ČNB rate API when currency is not CZK. Not idempotent: every call creates a new invoice with a new number, so never retry blindly — check list_invoices first. Validation errors (e.g. reverse-charge rules, missing customer or bank account) raise before anything is written and consume no number; an existing number or PDF is never overwritten. Needs supplier config from ucetka init. Confirm the customer (list_customers / lookup_company) and amounts with the user first. Use add_manual_invoice instead to record an invoice whose PDF already exists, and issue_credit_note to correct a delivered invoice. Next step is usually draft_invoice_email.

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": {
      "lines": "<lines>"
    },
    "name": "issue_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoFree text printed on the invoice. Omitted = none.
linesYesInvoice items (at least one); prices are per unit without VAT.
currencyNoISO 4217 currency code, e.g. 'CZK' (default) or 'EUR'. For anything other than CZK the ČNB exchange rate valid on the DUZP is downloaded from api.cnb.cz.CZK
due_daysNoDays from issue_date to the due date. Default 14; 0 = due on issue.
languageNoLanguage of the PDF: 'cs' Czech (default) or 'en' English; ledger and ISDOC stay Czech.cs
issue_dateNoIssue date YYYY-MM-DD. Omitted = today. Also determines the invoice number month.
customer_idNoCustomer key from the address book (see list_customers). Takes precedence over customer_ico and the customer_name/street/city/zip fields.
bank_accountNoCzech bank account to print instead of the supplier's default, format '[prefix-]number/bankcode', e.g. '19-2000145399/0100'. Required if supplier.yaml has no default.
customer_dicNoDIČ / EU VAT ID of a customer entered by name, e.g. 'DE123456789'. If given, the customer is treated as a VAT payer; required for reverse_charge (must not start with CZ).
customer_icoNoIČO (company ID, 8 digits) of a Czech customer not in the address book; details are fetched from ARES (network). Used only when customer_id is omitted.
customer_zipNoPostal code of a customer entered by name, e.g. '10115'.
customer_cityNoCity of a customer entered by name, e.g. 'Berlin'.
customer_nameNoName of a customer without IČO (e.g. a foreign company). Used only when customer_id and customer_ico are omitted, and then customer_street, customer_city and customer_zip are required too.
invoice_numberNoForce a specific number (letters, digits, '-' or '_', max 20 chars), e.g. '2610005'. Omitted = next free number YYMMNNN (see peek_invoice_number). Fails if it is already used.
reverse_chargeNoTrue for a service to a VAT payer in another EU country: no Czech VAT, the customer self-assesses. Requires customer_dic (non-CZ), a non-CZ country and vat_rate 0 on all lines. Default False.
tax_point_dateNoDUZP (tax point date) YYYY-MM-DD. Omitted = issue_date. Decides the VAT period, the ČNB rate date and the output folder.
customer_streetNoStreet and number of a customer entered by name, e.g. 'Musterstraße 1'.
customer_countryNoCountry name printed on the invoice for a customer entered by name, e.g. 'Německo'. Omitted = 'Česká republika'.
customer_country_codeNoISO 3166 alpha-2 country code of a customer entered by name, e.g. 'DE'. Default 'CZ'; must not be CZ for reverse_charge.CZ

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed29 schema fields changed
    • changedInput schema / $defs / LineInput / properties / description / description
      Previous value: -"Popis položky, např. 'Přednáška o AI'."New value: +"Item text printed on the document, e.g. 'Přednáška o AI' or 'AI workshop'."
    • changedInput schema / $defs / LineInput / properties / quantity / anyOf
      Previous value: -[
      -  {
      -    "exclusiveMinimum": 0,
      -    "type": "number"
      -  },
      -  {
      -    "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "exclusiveMinimum": 0,
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
    • changedInput schema / $defs / LineInput / properties / quantity / description
      Previous value: -"Počet jednotek (např. hodin)."New value: +"Number of units, e.g. 10 hours. Default 1."
    • changedInput schema / $defs / LineInput / properties / unit / description
      Previous value: -"Jednotka: 'ks', 'h', 'měsíc'…"New value: +"Unit label printed on the document: 'ks' (pieces, default), 'h' (hours), 'měsíc' (month)…"
    • changedInput schema / $defs / LineInput / properties / unit_price / anyOf
      Previous value: -[
      -  {
      -    "exclusiveMinimum": 0,
      -    "type": "number"
      -  },
      -  {
      -    "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "exclusiveMinimum": 0,
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
    • changedInput schema / $defs / LineInput / properties / unit_price / description
      Previous value: -"Jednotková cena BEZ DPH v měně faktury."New value: +"Price per unit WITHOUT VAT, in the document currency (e.g. 1500 = 1 500 CZK or 1 500 EUR). Must be positive, also on credit notes."
    • changedInput schema / $defs / LineInput / properties / vat_rate / anyOf
      Previous value: -[
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / $defs / LineInput / properties / vat_rate / description
      Previous value: -"Sazba DPH v % (21 / 12 / 0). Prázdné = 21 pro plátce, 0 pro neplátce a reverse charge."New value: +"VAT rate in percent: 21, 12 or 0. Omitted = 21 if the supplier is a VAT payer, 0 for a non-payer or reverse charge (on a credit note: the rate of the original invoice's first line). A non-payer or a reverse-charge invoice must use 0."
    • changedInput schema / properties / bank_account / description
      Previous value: -"Jiný než výchozí účet '[předčíslí-]číslo/kód'."New value: +"Czech bank account to print instead of the supplier's default, format '[prefix-]number/bankcode', e.g. '19-2000145399/0100'. Required if supplier.yaml has no default."
    • changedInput schema / properties / currency / description
      Previous value: -"Měna faktury (CZK, EUR…). Kurz ČNB k DUZP se doplní sám."New value: +"ISO 4217 currency code, e.g. 'CZK' (default) or 'EUR'. For anything other than CZK the ČNB exchange rate valid on the DUZP is downloaded from api.cnb.cz."
    • addedInput schema / properties / currency / pattern
      Added value: +"^[A-Z]{3}$"
    • changedInput schema / properties / customer_city / description
      Previous value: -"Město odběratele bez IČO."New value: +"City of a customer entered by name, e.g. 'Berlin'."
    • changedInput schema / properties / customer_country / description
      Previous value: -"Název země odběratele bez IČO, např. 'Německo'."New value: +"Country name printed on the invoice for a customer entered by name, e.g. 'Německo'. Omitted = 'Česká republika'."
    • changedInput schema / properties / customer_country_code / description
      Previous value: -"ISO kód země odběratele bez IČO."New value: +"ISO 3166 alpha-2 country code of a customer entered by name, e.g. 'DE'. Default 'CZ'; must not be CZ for reverse_charge."
    • changedInput schema / properties / customer_dic / description
      Previous value: -"DIČ / EU VAT ID odběratele bez IČO."New value: +"DIČ / EU VAT ID of a customer entered by name, e.g. 'DE123456789'. If given, the customer is treated as a VAT payer; required for reverse_charge (must not start with CZ)."
    • changedInput schema / properties / customer_ico / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "pattern": "^\\d{8}$",
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / customer_ico / description
      Previous value: -"IČO odběratele mimo adresář — údaje se vezmou z ARES."New value: +"IČO (company ID, 8 digits) of a Czech customer not in the address book; details are fetched from ARES (network). Used only when customer_id is omitted."
    • changedInput schema / properties / customer_id / description
      Previous value: -"Klíč z adresáře (list_customers)."New value: +"Customer key from the address book (see list_customers). Takes precedence over customer_ico and the customer_name/street/city/zip fields."
    • changedInput schema / properties / customer_name / description
      Previous value: -"Odběratel bez IČO (např. zahraniční firma)."New value: +"Name of a customer without IČO (e.g. a foreign company). Used only when customer_id and customer_ico are omitted, and then customer_street, customer_city and customer_zip are required too."
    • changedInput schema / properties / customer_street / description
      Previous value: -"Ulice a číslo odběratele bez IČO."New value: +"Street and number of a customer entered by name, e.g. 'Musterstraße 1'."
    • changedInput schema / properties / customer_zip / description
      Previous value: -"PSČ odběratele bez IČO."New value: +"Postal code of a customer entered by name, e.g. '10115'."
    • changedInput schema / properties / due_days / description
      Previous value: -"Splatnost ve dnech od vystavení."New value: +"Days from issue_date to the due date. Default 14; 0 = due on issue."
    • changedInput schema / properties / invoice_number / description
      Previous value: -"Vynucené číslo. Default další z evidence."New value: +"Force a specific number (letters, digits, '-' or '_', max 20 chars), e.g. '2610005'. Omitted = next free number YYMMNNN (see peek_invoice_number). Fails if it is already used."
    • changedInput schema / properties / issue_date / description
      Previous value: -"Datum vystavení YYYY-MM-DD. Default dnes."New value: +"Issue date YYYY-MM-DD. Omitted = today. Also determines the invoice number month."
    • changedInput schema / properties / language / description
      Previous value: -"Jazyk PDF faktury: cs (default) nebo en."New value: +"Language of the PDF: 'cs' Czech (default) or 'en' English; ledger and ISDOC stay Czech."
    • changedInput schema / properties / lines / description
      Previous value: -"Položky faktury."New value: +"Invoice items (at least one); prices are per unit without VAT."
    • changedInput schema / properties / note / description
      Previous value: -"Poznámka na faktuře."New value: +"Free text printed on the invoice. Omitted = none."
    • changedInput schema / properties / reverse_charge / description
      Previous value: -"Služba plátci DPH v jiném státě EU — daň odvede zákazník."New value: +"True for a service to a VAT payer in another EU country: no Czech VAT, the customer self-assesses. Requires customer_dic (non-CZ), a non-CZ country and vat_rate 0 on all lines. Default False."
    • changedInput schema / properties / tax_point_date / description
      Previous value: -"DUZP YYYY-MM-DD. Default = datum vystavení."New value: +"DUZP (tax point date) YYYY-MM-DD. Omitted = issue_date. Decides the VAT period, the ČNB rate date and the output folder."
  2. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Beyond the annotations (readOnly=false, idempotent=false, openWorld=true, destructive=false), the description discloses exact side-effect paths, outbound network calls to ARES and the ČNB rate API, non-idempotency with a no-blind-retry rule, and the transactional guarantee that validation errors raise before any write or number consumption. It also states that existing numbers or PDFs are never overwritten, which is the key safety fact for a write tool.

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?

Front-loaded with purpose and return value, then side effects, then failure semantics, then routing guidance — a logical order with almost no filler. Minor redundancy: the sentence listing summary fields duplicates what the output schema already conveys.

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

Completeness5/5

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

For a 19-parameter mutation with network calls, this is complete: it covers prerequisites, side effects, failure modes, non-idempotency, alternatives and follow-up steps. The output schema handles return values, so the description does not need to explain them further.

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

Parameters3/5

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

Schema description coverage is 100%, and the per-parameter descriptions already cover currency/ČNB behavior, reverse_charge prerequisites, invoice_number uniqueness and customer fallbacks. The description adds only a light cross-reference by mentioning reverse-charge and bank-account validation errors, so it stays at the baseline of 3 with no independent parameter detail.

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?

Names a specific verb and resource (issue a new invoice) and immediately specifies the artifacts produced: a PDF/A-3a with embedded ISDOC 6.0.2 and a QR Platba+F code, saved and recorded in the ledger. The return summary contents are spelled out, so an agent can distinguish this from sibling tools without opening the schema.

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

Usage Guidelines5/5

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

Explicitly routes to alternatives with conditions: add_manual_invoice when a PDF already exists, issue_credit_note to correct a delivered invoice, list_invoices before retrying, list_customers/lookup_company to confirm the customer, and draft_invoice_email as the usual next step. It also states a prerequisite (supplier config from `ucetka init`) and instructs confirming amounts with the user.

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