Skip to main content
Glama
ucetka-mcp

ucetka-mcp

Issue credit note

issue_credit_note

Creates a credit note for an already delivered invoice or partial discount, returning the PDF path and refund amounts.

Instructions

Issue a credit note (opravný daňový doklad / dobropis) for an issued invoice: PDF/A-3 with ISDOC (DocumentType 2), no QR code, with the next number in the regular series. Returns the PDF path and the reduction (base, VAT, total to refund).

Use it instead of cancel_invoice when the invoice was already delivered, or for a partial discount. Amounts on the document are positive; overviews and the VAT return subtract them in the period of the credit-note date. Side effects: writes ~/Documents/Účetnictví/Vydané faktury/<YY_MM_vydane>/dobropis_.pdf and a ledger record. Not idempotent: each call creates another credit note, but the total credited can never exceed the original's base. Fails if the original is unknown, cancelled or itself a credit note. Currency and exchange rate are taken from the original (no network). Confirm with the user first; then draft_invoice_email can send it.

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": {
      "original_number": "<original_number>",
      "reason": "<reason>"
    },
    "name": "issue_credit_note"
  }
}

Input Schema

NameRequiredDescriptionDefault
linesNoPartial credit only: the reductions as POSITIVE amounts (vat_rate omitted = the original's first-line rate). Omitted = credit the whole invoice.
reasonYesReason for the correction, printed on the document, e.g. 'sleva za zpoždění dodávky'.
issue_dateNoCredit note date = correction date and its DUZP, YYYY-MM-DD; not before the original's issue date. Omitted = today.
original_numberYesNumber of the issued invoice being corrected, e.g. '2610001'.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed13 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 / issue_date / description
      Previous value: -"Datum vystavení = datum opravy YYYY-MM-DD. Default dnes."New value: +"Credit note date = correction date and its DUZP, YYYY-MM-DD; not before the original's issue date. Omitted = today."
    • changedInput schema / properties / lines / description
      Previous value: -"Jen částečný dobropis: položky snížení v KLADNÝCH částkách. Prázdné = dobropis celé faktury."New value: +"Partial credit only: the reductions as POSITIVE amounts (vat_rate omitted = the original's first-line rate). Omitted = credit the whole invoice."
    • changedInput schema / properties / original_number / description
      Previous value: -"Číslo opravované faktury z evidence."New value: +"Number of the issued invoice being corrected, e.g. '2610001'."
    • addedInput schema / properties / original_number / pattern
      Added value: +"^[A-Za-z0-9_-]{1,20}$"
    • changedInput schema / properties / reason / description
      Previous value: -"Důvod opravy (tiskne se na doklad), např. 'sleva za zpoždění dodávky'."New value: +"Reason for the correction, printed on the document, e.g. 'sleva za zpoždění dodávky'."
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnly=false, idempotent=false, destructive=false, openWorld=false. The description goes well beyond them by naming the exact filesystem and ledger side effects, spelling out the non-idempotent accumulation rule ('each call creates another credit note, but the total credited can never exceed the original's base'), and listing concrete failure conditions (unknown, cancelled, or already-a-credit-note originals). It also confirms no network is used, matching openWorldHint=false rather than contradicting it.

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 the core action and document format, then usage routing, then side effects and failure modes – a sensible priority order. It is dense and nearly every clause carries information, though the closing 'Returns the PDF path and the reduction' is redundant given the output schema.

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 non-idempotent mutation tool with filesystem and ledger effects, the definition covers side effects, accumulation limits, preconditions, failure cases, currency sourcing, and the human-confirmation requirement. With an output schema present, the return-value detail is a bonus rather than a gap.

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?

Schema coverage is 100%, so the baseline is 3; the description adds some value by clarifying that omitted lines means crediting the whole invoice, that amounts on the document are positive, and that currency and exchange rate are inherited from the original. Much of this restates the schema's own line and issue_date descriptions, so the increment is real but modest.

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 names a specific verb and resource (issue a credit note / opravný daňový doklad, dobropis) and pins down the concrete artifact: PDF/A-3 with ISDOC DocumentType 2, no QR code, next number in the regular series. It is immediately distinguishable from cancel_invoice and issue_invoice without opening any 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?

It states exactly when to prefer this tool over the named alternative: 'Use it instead of cancel_invoice when the invoice was already delivered, or for a partial discount.' It also gives a workflow precondition ('Confirm with the user first') and a follow-on step ('then draft_invoice_email can send it'), leaving nothing to inference.

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