Skip to main content
Glama

Förhandsberäkna lön

calc_payroll
Read-onlyIdempotent

Förhandsberäkna en lönekörning (skatt + arbetsgivaravgift) UTAN att bokföra. Scope payroll. Argument: orgnr, year, month, pay_date (YYYY-MM-DD), entries ([{employee_id, gross_cash_ore, benefit_ore?, extra_tax_ore?, components?}]); extra_tax_ore justerar skatteavdraget (+extra skatt / −jämkning). components = lönearter [{kind, description?, amount_ore, category?}], kind ∈ LON|SEMESTER|OVERTID|SJUKLON|OB|SJUKAVDRAG|BRUTTOAVDRAG|FORMAN|UTLAGG|TRAKTAMENTE|MILERSATTNING|NETTOAVDRAG (positiva belopp; arten styr tecknet). TRAKTAMENTE och MILERSATTNING (tjänsteresa inom Sverige) delas mot Skatteverkets schablon för resans år: det som ryms är skattefritt (bolagets konton, standard 7321 och 7331, och kryss i ruta 051 respektive 050), det som överstiger blir lön med skatt och arbetsgivaravgift (ruta 011), och warnings visar uträkningen. TRAKTAMENTE: full_days, half_days, nights (utan betald logi), meals och half_day_meals ({breakfast, lunch, dinner} som arbetsgivaren betalat), long_stay (none, over_3_months, over_2_years) och trip_year (standard: körningens år). MILERSATTNING: mil och vehicle (egen_bil, formansbil, formansbil_el); för förmånsbil krävs fuel_paid_by_employee=true, annars blir allt lön. Utan antal dagar eller mil blir hela beloppet skattefritt med en varning. För FORMAN anger category förmånstypen, som styr rutan i arbetsgivardeklarationen: ovrig (012, standard), bil (013), drivmedel (018), bostad_smahus eller bostad_ejsmahus (värdet i 012 och kryss i 041 respektive 043). Valfritt note. Arbetsgivaravgiften åldersjusteras ur personnumret per pay_date (född 1937 eller tidigare 0 %, fyllt 67 vid årets ingång 10,21 %, unga 20,81 % upp till 25 000 kr i månaden april 2026 till september 2027, annars 31,42 %); employer_fee_note per rad förklarar, och notes listar anställda vars födelsedatum inte gick att läsa ut (full avgift används). warnings listar det som bör ses över men inte stoppar körningen: skattekolumn 3 för den som fyllt 66 vid årets ingång, utbetalningskonto som saknas och utlägg. Utlägg (UTLAGG) bokförs mot bolagets konto för utlägg (standard 2890, se get_payroll_accounts); kvittot bokförs för sig med kostnad och ingående moms mot samma konto så att det nollas. En anställd med skatteavdrag i procent (jämkning, upsert_employee) får det i stället för tabellen. Personnummer visas maskerade (ÅÅÅÅMMDD-XXXX); saknas ett personnummer läggs det in av användaren i Kvickd under Lön > Anställda.

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>",
      "year": "<year>",
      "month": "<month>",
      "pay_date": "<pay_date>",
      "entries": "<entries>"
    },
    "name": "calc_payroll"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNo
yearYes
monthYes
orgnrYesBolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies.
entriesYes
pay_dateYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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."
  2. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations, the description discloses important behavior: no booking occurs, warnings do not stop the run, employer fees are age-adjusted from personal identity numbers, personnummer are masked, and missing birth dates trigger full employer fees. These are substantive operational details not covered by readOnlyHint or idempotentHint.

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 with the core purpose and then proceeds through arguments and edge cases. It is unusually long and dense, but most of the detail is domain-specific and directly useful for invoking a complex payroll calculation correctly.

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?

Given a complex payroll calculation with no output schema and low schema description coverage, the definition is remarkably complete. It explains calculation rules, tax and employer-fee behavior, warnings, notes, and how special entry types are booked or treated.

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 description coverage is only 17%, so the description must compensate heavily. It documents the purpose of orgnr, year, month, pay_date, entries, and note, and gives extensive nested-entry semantics including components, TRAKTAMENTE, MILERSATTNING, FORMAN categories, extra_tax_ore, and account handling.

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 states a specific verb and resource: 'Förhandsberäkna en lönekörning (skatt + arbetsgivaravgift) UTAN att bokföra.' This clearly distinguishes the preview calculation from actual payroll booking, especially alongside the sibling run_payroll.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly establishes that this is a preview calculation without posting, which is strong usage context. It stops short of explicitly naming run_payroll as the follow-up alternative or spelling out when not to use this tool.

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.