Skip to main content
Glama

Close Purchase Order Short

close_purchase_order_short
DestructiveIdempotent

Close a purchase order short: accept that the units recorded missing on it will never arrive. Moves the order from Pending Receipt Resolution to Closed Short, writes the reason on each short line and sends its delivery receipt on to reconciliation. Nothing is received and no stock moves. First record the shortfall with receive_purchase_order (quantityReceived 0, quantityMissing the units that did not come; over-receipts go there too with confirmOverReceive); once every ordered unit is received or recorded missing, the order is Pending Receipt Resolution and can be closed here. get_purchase_order_receiving shows each line's ordered, received and missing units. Two-step: preview=true, then repeat the identical call with the previewReceipt and a fresh idempotencyKey. Requires Write + purchasing.execute.

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": {
      "purchaseOrder": "<purchaseOrder>",
      "reason": "<reason>"
    },
    "name": "close_purchase_order_short"
  }
}

Input Schema

NameRequiredDescriptionDefault
reasonYesWhy the missing units will not arrive (e.g. "Vendor discontinued SKU"), up to 500 characters. Recorded on each short line, as the Close Short dialog does.
previewNoStep 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing changes until the commit call.
purchaseOrderYesPurchase order id (GUID), document number (e.g. PO-2026-10-000118), or the short form people use for an open order: its last digits ("118", "PO 118").
idempotencyKeyNoCaller-generated idempotency key; required with previewReceipt to commit.
previewReceiptNoStep 2 of the required two-step write: the receipt returned by the preview call. Supply together with a fresh idempotencyKey to commit; calls without it are refused.

Output Schema

NameRequiredDescriptionDefault
okNo
effectsNo
previewNo
nextStepNo
expiresAtNo
actionItemIdNo
confirmationNo
correlationIdNo
purchaseOrderNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior4/5

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

Beyond the annotations (destructiveHint=true, idempotentHint=true), the description discloses the state transition, that the reason is written to every short line, that the delivery receipt is forwarded to reconciliation, and that no stock moves. It also discloses the required permissions (Write + purchasing.execute) and the mandatory preview/commit protocol. Minor gap: it does not say what happens if the order is not yet in Pending Receipt Resolution.

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?

Purpose and consequence are front-loaded in the first two sentences, then prerequisites follow. It is dense but long, with some restatement of the schema's reason/two-step wording that could be trimmed.

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, two-step write, the definition covers preconditions, state change, side effects, permissions, and the preview/commit mechanics. An output schema exists, so return-value description is not required, and the 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 adds real value by explaining the sequencing contract between preview, previewReceipt, and a fresh idempotencyKey, which the schema fields state only individually.

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 description opens with a precise verb+resource and its business meaning: "Close a purchase order short: accept that the units recorded missing on it will never arrive." It immediately distinguishes this from receiving or cancelling by stating the resulting state (Closed Short) and that "Nothing is received and no stock moves."

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?

It gives explicit preconditions and the exact alternative path: record the shortfall with receive_purchase_order first, then close here only once the order is in Pending Receipt Resolution. It also points to get_purchase_order_receiving to verify per-line ordered/received/missing quantities before acting.

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