Skip to main content
Glama

Update invoice

update_invoice
Destructive

Replaces an existing invoice with the values given. Use it to edit a draft, to finalize a draft (isDraft=false), or to correct the recipient details, buyer reference, note or style of a finalized invoice. On a draft this is a full replacement, not a partial update: all line items and discounts are deleted and recreated from the input, the amounts are recalculated, and any field left out is reset to empty or to the sender-settings default. On a finalized invoice the invoice number, invoice date, currency, shipping, the invoice-level discounts, the number of line items and each line's quantity, unit, price, VAT rate and discount are locked: a call that changes any of them is rejected and nothing is saved. Recipient details, buyer reference, note, style, due date and line item titles and descriptions can still change. A finalized invoice keeps the amounts it was issued with: its totals and line amounts are never recalculated and its line items and discounts are never deleted or recreated. lineItems and discounts left out stay as stored; when they are sent, they are matched to the stored rows by position, and only a line's title and description and a discount's label are written. A field left out keeps its current value, and an empty string clears an optional text field (street, second address line, state, VAT ID, email, buyer reference, note); company name, postal code, city and country cannot be emptied. get_invoice returns the current values to send back. invoiceDate and dueDate are written in the date format stored on the invoice, the dateFormat field of get_invoice, which can differ from the sender's current format and is not changed by this tool. A date that cannot be read as day, month and year in that format is rejected. The check goes no further: a date written in another format with the same separator is read in the expected order (03/04/2026 is 3 April in DD/MM/YYYY and 4 March in MM/DD/YYYY), a day past the end of its month rolls into the next one (31.02.2026 becomes 3 March), and a two-digit year is read as 19xx (26 is 1926). Left out on a draft, they are not kept: they are reset to today and today plus the sender's payment terms. Left out on a finalized invoice, they stay as stored. Finalizing a draft spends credits. Finalizing uses one free invoice if any remain, otherwise it deducts the per-invoice price from the credit balance. It fails when the balance is too low, and the charge is not refunded. A finalized invoice cannot go back to draft. With isDraft left out the invoice keeps its current status: a draft stays a draft and a finalized invoice stays finalized. Editing a finalized invoice changes a document the recipient may already have, and the previous values are not kept. Line item prices take unitPrice (decimal, e.g. 110.00) or unitPriceCents (integer, e.g. 11000); VAT rates are basis points (1900 = 19%). Side effect: the recipient gets a customer record if none exists under that company name, created from the recipient details of the invoice, and the invoice is linked to it. An existing customer record is not changed. It does not email anyone.

Input Schema

NameRequiredDescriptionDefault
idYesInvoice ID to update
dueDateNoDue date in the date format stored on the invoice (dateFormat from get_invoice). Reset to today + the sender's payment terms if omitted on a draft; kept unchanged on a finalized invoice.
isDraftNoSave as draft (true) or final (false, charges credits if converting from draft). Left out, the invoice keeps its current status.
currencyNoCurrency code. Defaults to sender settings for drafts; kept unchanged on a finalized invoice if omitted.
discountsNoInvoice-level discounts. On a draft they replace the stored ones, and all are removed when this is left out. On a finalized invoice the stored ones stay untouched when this is left out; when sent, there must be as many as stored, in the same order, with the same type and value, and only the label may differ.
lineItemsNoLine items. On a draft they replace the stored ones, and all are removed when this is left out. On a finalized invoice the stored ones stay untouched when this is left out; when sent, there must be as many as stored, in the same order, with the same quantity, unit, price, VAT rate and discount, and only title and description may differ.
vatRateBpsNoVAT rate in basis points. Defaults to sender settings for drafts; kept unchanged on a finalized invoice if omitted.
invoiceDateNoInvoice date in the date format stored on the invoice (dateFormat from get_invoice). Reset to today if omitted on a draft; kept unchanged on a finalized invoice.
invoiceNoteNo
invoiceStyleNoInvoice style. Defaults to sender settings for drafts; kept unchanged on a finalized invoice if omitted.
invoiceNumberNoInvoice number. Kept unchanged on a finalized invoice if omitted.
recipientCityNo
shippingCentsNoShipping cost in minor units. Defaults to 0 for drafts; kept unchanged on a finalized invoice if omitted.
buyerReferenceNo
recipientEmailNo
recipientStateNo
recipientVatIdNo
recipientStreetNo
recipientCountryNo
recipientPostalCodeNo
recipientCompanyNameNo
recipientAddressLine2No

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations declare destructiveHint=true and idempotentHint=false; the description substantiates both with concrete consequences: on a draft everything omitted is reset to empty or sender defaults, and on a finalized invoice edits change a document the recipient may already hold with previous values not kept. It also discloses the credit spend (free invoice first, then per-invoice deduction, non-refundable), the finalized-to-draft irreversibility, and the customer-record side effect, none of which annotations convey.

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

Conciseness3/5

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

The core operation is front-loaded, but the body is an undifferentiated wall of text with no paragraphing or grouping, and the lineItems/discounts rules are stated at least twice (the locked-field paragraph and the later "matched to the stored rows by position" paragraph). The date-parsing tangent about 03/04/2026 and 31.02.2026 is genuinely useful but runs long, and the draft/vs-finalized reset rules are repeated again in the schema properties.

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 destructive 22-parameter mutation with no output schema, an agent has what it needs: state-dependent semantics, locked versus mutable fields, credit cost and failure mode, side effects, and the fact that no email is sent. Nothing material about calling it correctly is left unstated.

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?

With 22 params at 50% schema coverage, the description is doing real work: it explains that on finalized invoices number, date, currency, shipping, discounts, line count and each line's quantity/unit/price/VAT/discount are locked while titles and descriptions can change, that position matching applies, that empty string clears only the listed optional text fields, and that unitPrice is decimal while VAT is basis points. That is semantic guidance the schema's partial coverage does not supply.

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 opening sentence states a specific verb and resource ("Replaces an existing invoice") and immediately scopes the behavior by document state. The follow-up enumerates the three legitimate intents (edit draft, finalize draft, correct finalized invoice), which lets an agent distinguish this from create_invoice, duplicate_invoice and update_customer without opening any schema.

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?

It gives explicit usage contexts and names get_invoice as the companion read call to fetch current values before writing. What is missing is an explicit when-not clause — nothing says to use create_invoice for new documents or duplicate_invoice to fork one — so routing to siblings still requires inference.

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