Skip to main content
Glama

Ekwo OS — open source accounting: ledger, invoices and VAT on your own Supabase or Postgres

Replace the lines of a draft

update_document_lines
DestructiveIdempotent

Replaces every line of a draft document with the set you give, and returns the document with its recomputed totals. Lines take product_code the same way create_document does. Drafts only: a posted document is never edited; cancel_document undoes it with a credit note.

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": {
      "document_id": "<document_id>",
      "lines": "<lines>"
    },
    "name": "update_document_lines"
  }
}

Input Schema

NameRequiredDescriptionDefault
linesYesThe complete new set of lines; what is there now is replaced.
document_idYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed35 schema fields changed
    • addedInput schema / properties / document_id / format
      Added value: +"uuid"
    • addedInput schema / properties / document_id / pattern
      Added value: +"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    • addedInput schema / properties / lines / description
      Added value: +"The complete new set of lines; what is there now is replaced."
    • addedInput schema / properties / lines / items / properties / account_code / description
      Added value: +"The income or expense account, by code. Left out: the product, then the company default, then the one its country model names. A company with none of them refuses the line."
    • addedInput schema / properties / lines / items / properties / account_code / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / account_id / format
      Added value: +"uuid"
    • addedInput schema / properties / lines / items / properties / account_id / pattern
      Added value: +"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    • addedInput schema / properties / lines / items / properties / attributes / additionalProperties / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / attributes / description
      Added value: +"What the electronic invoice format of the country asks of this line that no other field says, by the name its brick reads — describe_pack lists the names its format reads (line_attributes, tax_attributes). The product fills in the names the line leaves out; the line wins over the pack."
    • addedInput schema / properties / lines / items / properties / attributes / propertyNames / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / description / description
      Added value: +"EN 16931 BT-154, under the name. A product supplies it when the line does not."
    • addedInput schema / properties / lines / items / properties / description / minLength
      Added value: +1
    • removedInput schema / properties / lines / items / properties / discount_percent / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / lines / items / properties / discount_percent / description
      Added value: +"A percentage off this line, 0 to 99."
    • addedInput schema / properties / lines / items / properties / discount_percent / type
      Added value: +[
      +  "string",
      +  "number"
      +]
    • addedInput schema / properties / lines / items / properties / name / description
      Added value: +"What is billed, as it appears on the invoice. Required unless a product supplies it."
    • addedInput schema / properties / lines / items / properties / name / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / product_code / description
      Added value: +"A catalogue row, by code. It fills in the text, the price, the unit, the account and the tax; anything given on the line wins."
    • addedInput schema / properties / lines / items / properties / product_code / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / product_id / format
      Added value: +"uuid"
    • addedInput schema / properties / lines / items / properties / product_id / pattern
      Added value: +"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    • removedInput schema / properties / lines / items / properties / quantity / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / lines / items / properties / quantity / description
      Added value: +"Defaults to 1."
    • addedInput schema / properties / lines / items / properties / quantity / type
      Added value: +[
      +  "string",
      +  "number"
      +]
    • addedInput schema / properties / lines / items / properties / tax_code / description
      Added value: +"The tax, by code, e.g. BE-S-21. Left out, the tax of the product. With no product either, the line books a base with no VAT box, which is not the same as 0 %."
    • addedInput schema / properties / lines / items / properties / tax_code / minLength
      Added value: +1
    • addedInput schema / properties / lines / items / properties / tax_id / format
      Added value: +"uuid"
    • addedInput schema / properties / lines / items / properties / tax_id / pattern
      Added value: +"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    • addedInput schema / properties / lines / items / properties / unit_code / description
      Added value: +"Unit of measure, UN/ECE rec. 20: C62 a piece, HUR an hour, DAY a day, KGM, LTR, MTR. From the product, then C62."
    • addedInput schema / properties / lines / items / properties / unit_code / maxLength
      Added value: +3
    • addedInput schema / properties / lines / items / properties / unit_code / minLength
      Added value: +1
    • removedInput schema / properties / lines / items / properties / unit_price / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "number"
      -  }
      -]
    • addedInput schema / properties / lines / items / properties / unit_price / description
      Added value: +"Price of one unit, excluding tax, as a decimal string. Left out, the product's price; without either, the line is refused."
    • addedInput schema / properties / lines / items / properties / unit_price / type
      Added value: +[
      +  "string",
      +  "number"
      +]
    • addedInput schema / properties / lines / minItems
      Added value: +1
  2. Changed1 schema field changed
    • addedInput schema / properties / lines / items / properties / attributes
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
  3. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare destructive=true and idempotent=true; the description adds value by spelling out what is destroyed ('replaces every line... what is there now is replaced') and that totals are recomputed on return, plus the drafts-only guard. It stops short of saying what happens on a rejected call against a posted document (error vs. silent no-op), which is the one behavioral gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, each carrying a distinct fact: the mutation and its return, a parameter cross-reference, and the draft-only constraint with its alternative. Front-loaded and zero filler.

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 destructive two-parameter mutation with no output schema, the description covers the operation, the return value ('returns the document with its recomputed totals'), and the safety boundary. Only the failure mode for posted documents is left implicit.

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

Parameters3/5

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

Schema coverage is 50% at the top level, and the nested line properties are richly self-documented in the schema. The description adds one genuinely useful cross-reference ('Lines take product_code the same way create_document does') but does not explain document_id or the required/complete-set nature of lines beyond what the schema's own minItems/description already say.

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 (replaces), a specific resource (every line of a draft document), and the replacement semantics (with the set you give), plus what it returns. This clearly differentiates it from create_document, post_document, and cancel_document without needing 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?

Explicitly bounds usage: 'Drafts only: a posted document is never edited' states when-not, and it names the correct alternative for the posted case ('cancel_document undoes it with a credit note'). The agent has a complete routing rule.

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.