Skip to main content
Glama

Create Invoice

create_invoice

Invoice a sales order — the order page's Generate invoice. Bills every shipped unit not yet on an invoice (a draft counts), priced as the order lines are. Leaves a draft invoice by default; issue=true also issues it (numbers it, bills the order and sends it to connected accounting), like Save and confirm. The preview lists the lines and the totals after discounts and tax. Two-step: preview=true, then commit with the previewReceipt.

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": {
      "salesOrderId": "<salesOrderId>"
    },
    "name": "create_invoice"
  }
}

Input Schema

NameRequiredDescriptionDefault
issueNofalse (default) leaves an editable draft; true also issues it (issue_invoice's effect).
previewNoStep 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing is written until the commit call.
clientIdNoOptional client id (GUID) for operator (unpinned) credentials on 3PL tenants.
salesOrderIdYesSales order id (GUID) or number from get_sales_orders.
idempotencyKeyNoCaller-generated idempotency key; required with previewReceipt to commit.
previewReceiptNoStep 2: the receipt returned by the preview call. Supply with a fresh idempotencyKey to commit.

Output Schema

NameRequiredDescriptionDefault
okNo
issuedNo
numberNo
statusNo
previewNo
warningsNo
expiresAtNo
invoiceIdNo
totalAmountNo
actionItemIdNo
confirmationNo
documentKindNo
salesOrderIdNo
correlationIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
approvalRequiredNo
approvalRuleNameNo
idempotentReplayNo
salesOrderNumberNo

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?

Beyond the annotations (readOnly=false, destructive=false, idempotent=false), it discloses a lot: only uninvoiced shipped units are billed, pricing is inherited from order lines, drafts count as invoiced, the default is a non-issued draft, and issue=true pushes the invoice to connected accounting. It also flags the mandatory two-step write so an agent knows nothing persists until the commit call.

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?

Front-loaded with the purpose and the UI analogue, then the billing rule, then the default/issue fork, then the preview contract — a sensible ordering. A few clauses are dense and the issue=true behavior is partly duplicated from the schema, but no sentence is filler.

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 mutating, multi-step tool this covers everything an agent needs: what gets billed, the default draft state, the side effect of issuing, the preview contract, and the commit mechanism. An output schema exists, so return-shape detail is correctly omitted, and annotations already carry the safety profile.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description earns a bump by explaining the preview payload ('lists the lines and the totals after discounts and tax') and the sequencing between preview=true and previewReceipt, which the schema only states mechanically. The issue parameter is largely restated from the schema, so it is not a full 5.

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 ('Invoice a sales order') and anchors it to the concrete UI action it mirrors ('the order page's Generate invoice'). It also scopes the billing basis precisely ('every shipped unit not yet on an invoice (a draft counts)'), which separates it from issue_invoice, whose effect it explicitly attributes to the issue=true flag.

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?

Gives clear selection guidance for the main behavioral fork: default leaves an editable draft, issue=true also issues it 'like Save and confirm'. It also mandates the two-step preview-then-commit flow. It does not explicitly rule out alternatives (e.g., when to use issue_invoice directly), which keeps it at 4 rather than 5.

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