Skip to main content
Glama

Skapa kreditfaktura

credit_customer_invoice
Destructive

Skapa en kreditfaktura för en BOKFÖRD kundfaktura (utkast; negativa belopp, omvänd bokföring vid bokför). Ett utkast krediteras inte: ändra det med update_customer_invoice eller makulera det med cancel_customer_invoice. Utan rader krediteras hela originalet; ange lines ([{description, quantity_milli?, unit_price_ore, vat_rate, account?}]) för delkreditering. När krediten bokförs kvittas den mot originalets obetalda saldo; det som inte ryms där ska betalas tillbaka till kunden (register_customer_payment på kreditfakturan). Scope reconcile. Argument: orgnr, invoice_id; valfritt invoice_number (utelämnat tas nästa nummer i bolagets serie), invoice_date (inte före originalets fakturadatum), lines.

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": {
      "orgnr": "<orgnr>",
      "invoice_id": "<invoice_id>"
    },
    "name": "credit_customer_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
linesNo
orgnrYesBolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies.
invoice_idYes
invoice_dateNo
invoice_numberNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / invoice_number / default
      Added value: +""
    • changedInput schema / required
      Previous value: -[
      -  "orgnr",
      -  "invoice_id",
      -  "invoice_number"
      -]New value: +[
      +  "orgnr",
      +  "invoice_id"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / orgnr / description
      Added value: +"Bolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies."
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the mutation and destructive annotations, it discloses that the operation initially creates a draft, that booking reverses the accounting, and that the credit is offset against the original's unpaid balance. The refund behavior, reconcile scope, automatic numbering, and date restriction add further operational context without contradicting 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?

The description is front-loaded and nearly every clause supplies a precondition, alternative, default, or financial consequence. Its nested parentheses, semicolon-heavy prose, and final argument recap make it dense and slightly repetitive, though there is little genuinely disposable content.

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 financially consequential mutation with sparse schema and no output schema, it covers the principal lifecycle, prerequisites, alternatives, line behavior, settlement consequences, authorization scope, and defaults. It could still name book_customer_invoice as the explicit next step and clarify what draft data is returned, but these are minor workflow gaps rather than serious obstacles to invocation.

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 only 20% schema description coverage and an unspecified lines item schema, the description adds substantial value by documenting line-object keys and optionality, full-versus-partial behavior, invoice-number defaults, and the invoice-date constraint. However, invoice_id receives little direct explanation, and the date format and practical meaning of quantity_milli, unit_price_ore, vat_rate, and account remain partly implicit.

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 opening sentence specifies the operation, resource, precondition, and result: creating a draft credit invoice with negative amounts for a booked customer invoice. It also distinguishes full and partial credits and differentiates the tool from update_customer_invoice and cancel_customer_invoice for drafts.

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 explicitly restricts use to a BOKFÖRD invoice and provides concrete alternatives when the original is still a draft. It also explains when to omit lines for a full credit, supply them for a partial credit, and use register_customer_payment for an excess that must be refunded.

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.