Skip to main content
Glama

Factur-X: Generate & Validate E-Invoices

Draft a full or partial credit note

draft_credit_note
Read-onlyIdempotent

Draft a type-381 credit note from an existing invoice, for all lines or selected quantities.

Use to reverse an existing invoice's charges; use get_invoice_example for a synthetic credit-note example.
invoice must be the original generate_invoice input object, not extract_invoice output.
number and issue_date belong to the new credit note; the original number/date are copied into
preceding_invoices. Give number a distinct value and use YYYY-MM-DD dates. due_date replaces the
original deadline; omitting it removes that deadline rather than inheriting it.

Omit credit_lines to retain all original lines and amounts. Otherwise select distinct 1-based array
positions, not line ids: [{"line_index":1,"quantity":"2"}] credits two units of the first line.
Omitted lines are excluded; quantities cannot exceed the original. Prices and VAT rates are retained.
Selected-line mode clears original totals, prepayments, rounding and paid status for recalculation.
Document allowances/charges, or reduced quantities on adjusted lines or overridden net amounts,
need explicit allocation: these cases return an error; prepare a credit body for generate_invoice.
No prior-credit history is stored: the caller must prevent cumulative credits beyond the original.
Keep amounts positive: type 381 expresses the credit. Existing credit notes, a reused invoice number
or negative line amounts produce a tool error. Default payment remittance references follow the
new number; a custom reference is preserved. Returns invoice, type_code, preceding_invoice and next.
Pass the returned invoice to generate_invoice with the original profile to create the document.
No key or document quota is needed for drafting; nothing is stored, sent or refunded.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
numberYesCredit note number, different from the invoice number. Max 35 characters: letters, digits, and . _ / -.
invoiceYesThe original invoice object you passed to generate_invoice. Not an extract_invoice result.
due_dateNoOptional due date. Omit it to drop the original invoice due date.
issue_dateYesCredit note issue date, ISO 8601 (YYYY-MM-DD).
credit_linesNoSelected original line positions and quantities. Omit for a full credit; an empty list is invalid.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / invoice / type
      Added value: +"object"
  2. Changed2 schema fields changed
    • addedInput schema / $defs / CreditLine
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "line_index": {
      +      "description": "1-based position in the original invoice.lines array, not its id.",
      +      "minimum": 1,
      +      "title": "Line Index",
      +      "type": "integer"
      +    },
      +    "quantity": {
      +      "anyOf": [
      +        {
      +          "exclusiveMinimum": 0,
      +          "type": "number"
      +        },
      +        {
      +          "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,13}|(?=[\\d.]{1,20}0*$)\\d{0,13}\\.\\d{0,6}0*$)",
      +          "type": "string"
      +        }
      +      ],
      +      "description": "Positive quantity to credit, at most the original line quantity; decimal string.",
      +      "title": "Quantity"
      +    }
      +  },
      +  "required": [
      +    "line_index",
      +    "quantity"
      +  ],
      +  "title": "CreditLine",
      +  "type": "object"
      +}
    • addedInput schema / properties / credit_lines
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/CreditLine"
      +      },
      +      "minItems": 1,
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Selected original line positions and quantities. Omit for a full credit; an empty list is invalid.",
      +  "title": "Credit Lines"
      +}
  3. Added

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only cover the safety profile (readOnlyHint/idempotentHint/openWorldHint); the description adds substantial behavior: nothing is stored, sent or refunded, no key or document quota needed, omitted due_date removes the deadline rather than inheriting it, selected-line mode clears totals/prepayments/rounding/paid status, and specific error conditions (existing credit notes, reused number, negative amounts, allocation cases). These disclosures go well beyond the annotations.

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 is front-loaded in the first sentence and every subsequent sentence adds a distinct rule (mode selection, identifier handling, allocation errors, idempotency caveat). It is long at roughly ten sentences, but dense rather than padded; a tighter grouping of the error conditions would improve it.

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 complex, nested-object tool with an output schema, the description covers mode selection, identifier/date handling, recalculation side effects, error cases and the hand-off to generate_invoice. An agent has everything needed to invoke it correctly without inferring.

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, but the description adds non-obvious semantics: number/issue_date belong to the new note while the original values are copied into preceding_invoices, credit_lines use distinct 1-based array positions (not ids, with a worked example), omitted lines are excluded, quantities cannot exceed the original, and prices/VAT are retained. Some of this now duplicates schema text, which slightly caps the score.

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, resource and regulatory type ('Draft a type-381 credit note from an existing invoice') plus the two operating modes (all lines or selected quantities). It also names the sibling tools it relates to (get_invoice_example, generate_invoice, extract_invoice), so an agent can place it precisely among the siblings.

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: 'Use to reverse an existing invoice's charges; use get_invoice_example for a synthetic credit-note example', and directs the caller to 'prepare a credit body for generate_invoice' when allocation cases arise. It also states when not to rely on it ('No prior-credit history is stored: the caller must prevent cumulative credits').

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.

Resources