Skip to main content
Glama

Skapa kundfaktura

create_customer_invoice

Skapa en kundfaktura (utkast; bokförs inte förrän du bokför den). Scope reconcile. Rader: [{description, period?, quantity_milli?, unit_price_ore, vat_rate, account?}] (antal ×1000). Radens account = intäktskonto; utelämnas det används income_account, annars 3001. Radens belopp (antal × pris) avrundas först till hela öre per rad (0,5 uppåt). Momsen räknas sedan per momssats på summan av raderna och avrundas till närmaste öre (0-4 nedåt, 5-9 uppåt); skickas total_ore och vat_ore med raderna kontrolleras att de stämmer, annars avvisas fakturan med Kvickds belopp. Utan rader anges total_ore/vat_ore/income_account (enradsläge). Momsen bokförs på rate-specifikt konto (25 %→2611, 12 %→2621, 6 %→2631, BAS 2026) så deklarationen hamnar i rätt ruta. Argument: orgnr, customer_name, invoice_date; valfritt invoice_number (unikt per bolag; utelämnat tas nästa nummer i bolagets serie), customer_id (kund i kundregistret; kundens org.nr, adress, e-post och referens följer med), lines, due_date, ocr, income_account, total_ore, vat_ore, currency (default SEK), rounding_ore (öresutjämning), customer_orgnr, customer_address, customer_email, customer_reference, payment_terms, service_description, seller_address (avsändarens adress, rullas fram), seller_bank, seller_iban, seller_bic, seller_bankgiro, seller_contact, customer_vat_number, customer_country (ISO-kod, t.ex. DE), vat_mode, show_late_interest (false döljer villkoret om dröjsmålsränta på just den här fakturan; har bolaget dolt villkoret syns det inte på någon faktura, se update_invoice_settings). Försäljning till ett företag i annat EU-land: vat_mode eu_tjanster (omvänd betalningsskyldighet, konto 3308, ruta 39) eller eu_varor (unionsintern leverans, konto 3108, ruta 35); kräver köparens momsregistreringsnummer från det landet, raderna får 0 % moms och fakturan hänvisningen till mervärdesskattedirektivet. Försäljningen ska även redovisas i periodisk sammanställning, som användaren lämnar i Skatteverkets e-tjänst. Utan due_date räknas förfallodagen fram ur payment_terms (t.ex. "30 dagar"); utan payment_terms gäller kundens eller bolagets villkor. Förfallodagen får inte vara före invoice_date. Ändra i efterhand med update_customer_invoice. ROT/RUT (husarbete till privatperson): märk raderna med husarbete_kind (arbete|material|ovrigt), och för arbetsrader work_type (Skatteverkets kategori, se arbetstyper i list_rot_rut, t.ex. Bygg, El, Vvs, Stadning, Tradgardsarbete) samt hours_milli (arbetade timmar ×1000, krävs även vid fast pris). Skicka husarbete = {type: ROT|RUT, buyers?: [{name?, amount_ore?}], amount_ore?, property? (fastighetsbeteckning) ELLER brf_orgnr + apartment (bostadsrätt)}. Utan buyers blir kunden köpare. Köparnas personnummer tas inte emot här: användaren lägger in dem i Kvickd under Kundfakturor (Redigera fakturan, ROT/RUT-uppgifterna), och fakturan kan bokföras först när de finns. Be inte om personnummer i chatten. Utan belopp begärs högsta möjliga avdrag (ROT 30 %, RUT 50 % av arbetskostnaden inkl. moms; tak 50 000/75 000 kr per person och år). Svaret har husarbete.to_pay_ore = det kunden betalar och husarbete.missing = det som saknas för bokföring. Valfritt delivery_date: leveransdatum när det skiljer sig från fakturadatumet (t.ex. en förskottsfaktura). Fakturan skapas i SEK.

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>",
      "customer_name": "<customer_name>",
      "invoice_date": "<invoice_date>"
    },
    "name": "create_customer_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
ocrNo
linesNo
orgnrYesBolagets organisationsnummer, 10 siffror med eller utan bindestreck, t.ex. 559900-1004. Hämta med list_companies.
vat_oreNo
currencyNoSEK
due_dateNo
vat_modeNo
husarbeteNo
total_oreNo
seller_bicNo
customer_idNo
seller_bankNo
seller_ibanNo
invoice_dateYes
rounding_oreNo
customer_nameYes
delivery_dateNo
payment_termsNo
customer_emailNo
customer_orgnrNo
income_accountNo
invoice_numberNo
seller_addressNo
seller_contactNo
seller_bankgiroNo
customer_addressNo
customer_countryNo
customer_referenceNo
show_late_interestNo
customer_vat_numberNo
service_descriptionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / delivery_date
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Delivery Date"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / show_late_interest
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Show Late Interest"
      +}
  3. Changed6 schema fields changed
    • addedInput schema / properties / total_ore / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / total_ore / default
      Previous value: -0New value: +null
    • removedInput schema / properties / total_ore / type
      Removed value: -"integer"
    • addedInput schema / properties / vat_ore / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / vat_ore / default
      Previous value: -0New value: +null
    • removedInput schema / properties / vat_ore / type
      Removed value: -"integer"
  4. Changed3 schema fields changed
    • addedInput schema / properties / customer_country
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Customer Country"
      +}
    • addedInput schema / properties / customer_vat_number
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Customer Vat Number"
      +}
    • addedInput schema / properties / vat_mode
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Vat Mode"
      +}
  5. Changed2 schema fields changed
    • addedInput schema / properties / invoice_number / default
      Added value: +""
    • changedInput schema / required
      Previous value: -[
      -  "orgnr",
      -  "customer_name",
      -  "invoice_number",
      -  "invoice_date"
      -]New value: +[
      +  "orgnr",
      +  "customer_name",
      +  "invoice_date"
      +]
  6. Changed1 schema field changed
    • addedInput schema / properties / customer_id
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Customer Id"
      +}
  7. 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."
  8. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations only declare the generic profile (not read-only, not destructive, non-idempotent, closed-world), while the description discloses the real behavioral contract: draft-not-booked semantics, invoice_number uniqueness and auto-sequencing, line-level rounding then per-rate VAT rounding, rejection when total_ore/vat_ore disagree with computed amounts, VAT posted to rate-specific accounts (2611/2621/2631) affecting the declaration box, and response fields husarbete.to_pay_ore / husarbete.missing. This is substantial added context beyond the structured hints.

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 critical fact (draft, unposted) is front-loaded and each sentence carries a rule rather than filler, so the length is largely earned by 31 parameters and multi-country VAT logic. It is still one undifferentiated block of prose with no line breaks or grouping, which makes the ROT/RUT and EU sections harder to locate on a scan; light structuring would raise this.

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 high-complexity mutation tool with 31 parameters, no output schema and near-zero schema documentation, the description covers the required inputs, defaults, validation failure modes, the ROT/RUT prerequisite and the shape of the returned husarbete object. An agent has what it needs to build a valid call and to predict what happens on invalid amounts.

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 3% with 31 parameters, so the description carries the full burden and does: it documents line object fields, quantity_milli ×1000 scaling, per-line account defaulting to income_account then 3001, total_ore/vat_ore as a single-line alternative to lines, the husarbete object shape, vat_mode enum values, ISO country codes, and the payment_terms/due_date derivation rule. Almost every non-obvious parameter gains meaning that the schema does not provide.

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?

Starts with a specific verb and resource ("Skapa en kundfaktura") and immediately qualifies the created object as a draft that is not posted until booking, which separates it cleanly from book_customer_invoice and credit_customer_invoice. The scope of what the invoice can carry (lines, EU VAT modes, ROT/RUT) is stated concretely rather than left to inference.

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?

Explicit routing is present: "Ändra i efterhand med update_customer_invoice", company settings via update_invoice_settings, and work-type categories via list_rot_rut. It also defines branch conditions for when to use which mode (EU B2B services vs goods, ROT/RUT for private individuals, delivery_date for advance invoices) and states the precondition that ROT/RUT invoices cannot be booked until personal numbers exist, with an explicit instruction not to request them in chat.

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.