Skip to main content
Glama

Add document line

add_document_line

Add ONE new line to an EXISTING document (invoice, quote, bill and so on); to create the document itself use save_document, and to change a line already on it use update_document_item.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "add_document_line"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoLine item id. Required on update_document_item; omit on add_document_line.
costNoUnit cost (for margin / cost-of-sales), in :costcurrency.
nameNoLine item name / title.
sortNoDisplay order of the line within the document (ascending).
unitNoUnit label for the quantity (e.g. "hours", "kg").
priceNoUnit price (per-unit selling price) in the document currency.
amountNoLine total (unit price × quantity), usually derived from :price × :quantity. Accepts a number or a numeric string.
expenseNoPass "$delete" to unlink the expense this line recovers; the line keeps its name, account and amount. Rebilling is add-only, so any other value is refused.
productNoId of a catalog product to link this line to.
variantNoId of a catalog product variant to link this line to.
quantityNoNumber of units. Accepts a number or a numeric string.
accountidNoPer-line chart-of-accounts / expense-category id; bills split cost by category at accrual (see list_accounts).
expenseidNoRecover this expense's cost on a sales invoice, order or pro-forma (quinvoice or contract id). The expense is copied onto the line once: its name, its category account (the line credits that account, not Sales; an uncategorised expense books to the document's income account, Sales by default) and its amount. A VAT-registered business bills the net amount plus its own output VAT; otherwise the gross amount, untaxed. Later edits to the expense do not change the line. Recovering an expense that is already on a live document is allowed: the response's billedon lists the live documents that already recovered it before this add (this document too, when it is already on another of its lines), so the caller can warn.
quinvoiceNoId of the parent document (invoice, quote, bill, etc.) this line belongs to.
responseidNoInternal: correlation id used to return the updated entity to the frontend; omit.
descriptionNoLine item description.
costcurrencyNoISO 4217 currency of :cost, when it differs from the document currency.
baseupdatedatNoOptimistic-concurrency token: the line's last-known updatedat (epoch number or ISO string). A stale value is rejected; omit to skip the check.
stocklocationidNoStock location this line moves stock at; one of your active locations. Omit for the variant or product default; "$delete" re-stamps that default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / stocklocationid
      Added value: +{
      +  "description": "Stock location this line moves stock at; one of your active locations. Omit for the variant or product default; \"$delete\" re-stamps that default.",
      +  "type": "string"
      +}
  2. Changed1 schema field changed
    • addedInput schema / properties / expense
      Added value: +{
      +  "description": "Pass \"$delete\" to unlink the expense this line recovers; the line keeps its name, account and amount. Rebilling is add-only, so any other value is refused.",
      +  "type": "string"
      +}
  3. Changed2 schema fields changed
    • changedInput schema / properties / expenseid / description
      Previous value: -"Rebill this expense onto a sales invoice. The line's name, amount and tax come from the expense: a VAT-registered business bills the net amount plus its own output VAT; otherwise the gross amount, untaxed. An expense already on a live invoice is refused."New value: +"Recover this expense's cost on a sales invoice, order or pro-forma (quinvoice or contract id). The expense is copied onto the line once: its name, its category account (the line credits that account, not Sales; an uncategorised expense books to the document's income account, Sales by default) and its amount. A VAT-registered business bills the net amount plus its own output VAT; otherwise the gross amount, untaxed. Later edits to the expense do not change the line. Recovering an expense that is already on a live document is allowed: the response's billedon lists the live documents that already recovered it before this add (this document too, when it is already on another of its lines), so the caller can warn."
    • removedInput schema / properties / markuppercent
      Removed value: -{
      -  "anyOf": [
      -    {
      -      "type": "integer"
      -    },
      -    {
      -      "type": "number"
      -    }
      -  ],
      -  "description": "Markup on a rebilled expense, as a percentage of its base (10 = 10%). Only read with expenseid."
      -}
  4. Changed2 schema fields changed
    • addedInput schema / properties / expenseid
      Added value: +{
      +  "description": "Rebill this expense onto a sales invoice. The line's name, amount and tax come from the expense: a VAT-registered business bills the net amount plus its own output VAT; otherwise the gross amount, untaxed. An expense already on a live invoice is refused.",
      +  "type": "string"
      +}
    • addedInput schema / properties / markuppercent
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "number"
      +    }
      +  ],
      +  "description": "Markup on a rebilled expense, as a percentage of its base (10 = 10%). Only read with expenseid."
      +}
  5. Changed16 schema fields changed
    • addedInput schema / properties / accountid / description
      Added value: +"Per-line chart-of-accounts / expense-category id; bills split cost by category at accrual (see list_accounts)."
    • addedInput schema / properties / amount / description
      Added value: +"Line total (unit price × quantity), usually derived from :price × :quantity. Accepts a number or a numeric string."
    • addedInput schema / properties / baseupdatedat / description
      Added value: +"Optimistic-concurrency token: the line's last-known updatedat (epoch number or ISO string). A stale value is rejected; omit to skip the check."
    • addedInput schema / properties / cost / description
      Added value: +"Unit cost (for margin / cost-of-sales), in :costcurrency."
    • addedInput schema / properties / costcurrency / description
      Added value: +"ISO 4217 currency of :cost, when it differs from the document currency."
    • addedInput schema / properties / description / description
      Added value: +"Line item description."
    • addedInput schema / properties / id / description
      Added value: +"Line item id. Required on update_document_item; omit on add_document_line."
    • addedInput schema / properties / name / description
      Added value: +"Line item name / title."
    • addedInput schema / properties / price / description
      Added value: +"Unit price (per-unit selling price) in the document currency."
    • addedInput schema / properties / product / description
      Added value: +"Id of a catalog product to link this line to."
    • addedInput schema / properties / quantity / description
      Added value: +"Number of units. Accepts a number or a numeric string."
    • addedInput schema / properties / quinvoice / description
      Added value: +"Id of the parent document (invoice, quote, bill, etc.) this line belongs to."
    • addedInput schema / properties / responseid / description
      Added value: +"Internal: correlation id used to return the updated entity to the frontend; omit."
    • addedInput schema / properties / sort / description
      Added value: +"Display order of the line within the document (ascending)."
    • addedInput schema / properties / unit / description
      Added value: +"Unit label for the quantity (e.g. \"hours\", \"kg\")."
    • addedInput schema / properties / variant / description
      Added value: +"Id of a catalog product variant to link this line to."
  6. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=false and destructiveHint=false, and the description correctly reinforces the additive, non-destructive nature (new line only, no mutation of existing lines). However, it adds no behavioral context beyond scope — nothing about permissions, what the response contains, stock side effects, or the fact that an expense link is copied once and not tracked afterward; those details live only in the schema property text.

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?

A single sentence with the positive case front-loaded and the two routing alternatives trailing. Every clause earns its place; no restatement of the title or annotations.

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 19-parameter mutation with no output schema, the description covers the essential routing decision and the add-only semantics, and the schema carries the deep per-parameter behavior. The one remaining gap is minimal-call guidance: with zero required parameters, the agent gets no hint about which fields are actually necessary to create a usable line.

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 description coverage is 100%, so the baseline is 3; the description adds only the implicit point that a single line's fields are supplied per call. It does not clarify which of the 19 optional parameters are effectively needed (the schema lists zero required, yet attaching a line to a document presumably needs quinvoice), leaving that inference to the schema.

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 ("Add ONE new line to an EXISTING document") with scope qualifiers (ONE, EXISTING) and enumerates document types. It explicitly distinguishes itself from save_document (create the document) and update_document_item (change an existing line), so an agent can route without opening other schemas.

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 and when-not-to-use rules plus named alternatives: use save_document to create the parent, use update_document_item to modify a line already present. The "ONE" emphasis also implies batching requires repeated calls rather than a bulk variant.

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.

Resources