Skip to main content
Glama

Backa leverantörsbetalning

reverse_supplier_payment
Destructive

Backar den senast registrerade betalningen på en leverantörsfaktura med ett motverifikat, så att fakturan blir obetald igen. Använd när en betalning har registrerats fel eller inför makulering med cancel_supplier_invoice; för att registrera en betalning, använd register_supplier_payment. Returnerar fakturan med nytt saldo och status. Bieffekt: ett omvänt betalningsverifikat bokförs och originalet ligger kvar. En betalning i taget, senast registrerad först, även över räkenskapsår; anropa igen för nästa. Ger ett fel om fakturan saknar betalning. returned=true när betalningen faktiskt gick tillbaka: motposten bokförs då med dagens datum. Utan returned rättas en felregistrerad betalning; fråga användaren vilket som gäller (för en faktura med kontantmetoden måste returned anges). Ligger betalningen i ett stängt räkenskapsår går bara returned=true. Kräver behörigheten book.

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": "reverse_supplier_payment"
  }
}

Input Schema

NameRequiredDescriptionDefault
orgnrYesBolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies.
returnedNo
invoice_idYesLeverantörsfakturans id (heltal), t.ex. 42. Hämta med list_supplier_invoices.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / returned
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Returned"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / invoice_id / description
      Added value: +"Leverantörsfakturans id (heltal), t.ex. 42. Hämta med list_supplier_invoices."
  3. 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."
  4. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations declare a destructive, non-idempotent write, and the description goes well beyond that: it discloses the counter-voucher side effect, that the original entry remains, the permission requirement (book), the closed-fiscal-year restriction, and date-booking behavior for the counter entry. It also explains the error path for invoices without payments.

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, then alternatives, then side effects and the `returned` rule — no filler sentences. It is dense and several sentences are long, but nearly every clause carries operational information an agent needs.

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 destructive financial mutation with no output schema, the description covers return value (the invoice with new balance and status), side effects, ordering constraints, permissions, and the key branching rule on `returned`. Little is left for the agent to infer.

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

Parameters5/5

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

Schema coverage is only 67% and the `returned` parameter has no schema description at all; the description fully compensates by explaining that returned=true books the counter entry with today's date, that omitting it corrects a misregistration, that the user must be asked which applies, and that cash-method invoices and closed fiscal years require returned=true.

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 resource ('Backar den senast registrerade betalningen på en leverantörsfaktura med ett motverifikat') and the resulting state change ('fakturan blir obetald igen'). It explicitly separates itself from register_supplier_payment and cancel_supplier_invoice, so an agent can pick it without reading 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?

Gives explicit when-to-use ('när en betalning har registrerats fel eller inför makulering med cancel_supplier_invoice') and names the alternative for the opposite operation. Also states sequencing rules (one payment at a time, most recent first, call again for the next) and the error condition when no payment exists.

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.