Skip to main content
Glama

Bokför verifikat med underlag

create_voucher

Bokför ett verifikat i huvudboken med tecknade belopp (debet positivt, kredit negativt), som när en människa använder bokföringsformuläret i appen. Använd för fristående bokningar, t.ex. skatteberäkningens poster efter godkännande, och när kvitton eller fakturor ska kopplas direkt via document_ids eller underlag_ids. Ska verifikatet hänvisa till källor (basis), använd book_voucher; ska en människa granska först, använd propose_voucher. Returnerar verifikatets id, serie och nummer. Bieffekt: verifikatet postas direkt. Koden validerar att summan blir 0 och att det finns minst två rader, och ett satt bokföringstak får inte överstigas. Underlag i annan valuta än SEK: gissa aldrig växelkursen. Fråga användaren efter kursen (SEK per 1 enhet) eller SEK-beloppet (t.ex. det som drogs från kontot), räkna raderna i SEK och ange currency, foreign_amount_minor och fx_rate eller total_sek_ore, så dokumenteras kursen på verifikatet. Ett datum mer än 30 dagar fram kräver confirm=true efter att användaren bekräftat datumet. Kräver behörigheten book. rows: [{konto, belopp_ore, text?, vat_code?}], t.ex. [{"konto": 6110, "belopp_ore": 12500}, {"konto": 1930, "belopp_ore": -12500}] (account och amount_ore går också, liksom debit_ore/credit_ore som i propose_voucher).

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>",
      "date": "<date>",
      "rows": "<rows>",
      "text": "<text>"
    },
    "name": "create_voucher"
  }
}

Input Schema

NameRequiredDescriptionDefault
dateYes
rowsYes
textYes
orgnrYesBolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies.
seriesNoA
confirmNo
fx_rateNo
currencyNo
document_idsNo
external_refNo
underlag_idsNo
total_sek_oreNo
foreign_amount_minorNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / external_ref
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "External Ref"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / confirm
      Added value: +{
      +  "default": false,
      +  "title": "Confirm",
      +  "type": "boolean"
      +}
  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.8/5.0
Behavior5/5

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

Annotations only tell the agent this is a non-readonly, non-destructive, non-idempotent write; the description adds the real behavioural facts: the voucher is posted immediately as a side effect, the code validates that rows sum to zero and that at least two rows exist, a booking cap must not be exceeded, and a date more than 30 days ahead requires confirm=true only after user confirmation. It also spells out the foreign-currency handling path (never guess the rate; ask for SEK per unit or the SEK total, then set currency/foreign_amount_minor plus fx_rate or total_sek_ore).

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, then use cases, then routing alternatives, then side effects and validation, then currency and date edge cases — a sensible order with no filler sentences. It is long, and the currency/date paragraphs plus the repeated row-alias enumeration make it dense; some of that could be tightened, but nearly every sentence carries operational meaning.

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?

No output schema exists, yet the description states what is returned (voucher id, series and number), which closes that gap. For a 13-parameter, non-idempotent accounting write with immediate posting, the description covers side effects, validation failures, permissions, FX requirements and the confirm gate — the agent has what it needs to call it safely.

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 description coverage is 8% and rows items are untyped ({}), so the description carries almost the full burden — which it largely does, giving the row shape (konto, belopp_ore, text?, vat_code?) with a worked balanced example and the accepted alias field names. It also explains the fx_rate/foreign_amount_minor/total_sek_ore relationship and the trigger for confirm. Still silent on series (default "A") and external_ref, leaving two of thirteen parameters unelaborated.

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 ("Bokför ett verifikat i huvudboken") plus the domain rule that amounts are signed (debet positive, kredit negative). It explicitly differentiates itself from two siblings with near-identical names, book_voucher (basis references) and propose_voucher (human review first), so an agent can pick without opening another 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?

Names concrete use cases ("fristående bokningar, t.ex. skatteberäkningens poster efter godkännande", attaching receipts via document_ids/underlag_ids) and gives two explicit routing rules: use book_voucher when the voucher must reference sources, use propose_voucher when a human should review first. A required permission ("book") is also stated as a precondition.

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.