Skip to main content
Glama

Cancel Purchase Order

cancel_purchase_order
DestructiveIdempotent

Cancel a purchase order that is Open, Created, Waiting Approval or Issued and has no delivery receipt (an order already being received is handled in receiving). The preview shows the order, vendor, total and status change. 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": {
      "purchaseOrderId": "<purchaseOrderId>"
    },
    "name": "cancel_purchase_order"
  }
}

Input Schema

NameRequiredDescriptionDefault
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.
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.
purchaseOrderIdYesPurchase 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").

Output Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
Behavior4/5

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

Beyond destructiveHint=true and idempotentHint=true, the description discloses the state preconditions, the permission scope (Write + purchasing.execute), and what the preview returns (order, vendor, total, status change). It stops short of saying whether cancellation is reversible or what happens to related documents/lines, and the two-step commit requirement lives only in the schema.

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 sentences, each load-bearing: eligibility first, preview output second, required permission third. No restatement of the title and no 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?

A destructive, two-step write with an output schema; the description covers preconditions, authorization and preview contents, which is most of what an agent needs before calling. The remaining gap is the commit semantics (that a second call with previewReceipt + idempotencyKey is required to actually cancel), which the description omits and only the schema supplies.

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 100%, so the schema already explains preview, previewReceipt, idempotencyKey and the flexible purchaseOrderId formats; baseline 3 applies. The description's single sentence about preview duplicates rather than extends that parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb+resource ("Cancel a purchase order") and adds the exact eligibility band: Open, Created, Waiting Approval or Issued with no delivery receipt. An agent can separate it from cancel_manufacturing_order or cancel_pickup_order by resource, but nothing here distinguishes it from transition_purchase_order or preview_purchase_order_transition, even though the description itself calls the effect a "status change".

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 a clear when-to-use condition (the four eligible statuses) and a when-not boundary ("an order already being received is handled in receiving"). The alternative is described by domain rather than by tool name, so the agent must map "receiving" onto get_purchase_order_receiving or receive_purchase_order itself.

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