Skip to main content
Glama

Create Purchase Order

create_purchase_order

Create a forward PURCHASE ORDER to a vendor — a draft (status "created") an operator then issues. Give the vendor, the destination warehouse, and the lines to buy; each line names an item (by itemSku OR itemId) and a quantity, with an optional unitCost (omit it to price from the vendor's price book, then the item's catalog cost, then its last purchase cost — each preview line names its costSource) and optional line expense. Payment terms default to the vendor's standard terms. Items are resolved against the tenant's catalog — a client-pinned token only resolves its OWN client's items and stamps the PO to that client. Use get_reorder_recommendations first to decide what to buy, then create_purchase_orders_from_recommendations to convert a whole reorder sweep in one call; reach for this tool for an explicit, hand-built PO. When the user names an item but not a vendor, resolve the vendor from the item's own sourcing data (its default vendor on list_items, or list_item_sourcing_profiles) rather than guessing from the item's brand or name; only ask when the item has no default vendor or several plausible ones. Max 500 lines per call.

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": {
      "supplierId": "<supplierId>",
      "destinationWarehouseId": "<destinationWarehouseId>",
      "lines": "<lines>"
    },
    "name": "create_purchase_order"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoOptional free-text note stored on the PO.
linesYesThe lines to order (max 500). Each names an item and a quantity.
previewNoStep 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing is created until the commit call.
supplierIdYesVendor id (GUID) to buy from — must be an existing vendor on this tenant.
expectedDateNoOptional expected delivery date (ISO 8601) — recorded as the PO's due date. When omitted, the due date is today (the tenant's calendar day) plus the effective lead time: the latest line's, from the same cascade the reorder point uses (manual override, the vendor's price book, purchase history, the vendor's default lead time, then a system default).
paymentTermsNoOptional payment terms printed on the order (e.g. Net 30). Omit to use the vendor's standard terms.
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.
supplierInvoiceNumberNoOptional vendor invoice/reference number.
destinationWarehouseIdYesDestination warehouse id (GUID) where the goods will be received.

Output Schema

NameRequiredDescriptionDefault
okNo
dueAtNo
numberNo
statusNo
previewNo
clientIdNo
warningsNo
expiresAtNo
lineCountNo
supplierIdNo
totalAmountNo
actionItemIdNo
confirmationNo
supplierNameNo
correlationIdNo
totalQuantityNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
purchaseOrderIdNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior3/5

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

Annotations only declare the generic write profile (readOnlyHint=false, destructiveHint=false, openWorldHint=false, idempotentHint=false), so the description has to carry the real behavioral burden — and it does describe the two-step preview/commit flow, the single-use previewReceipt, the idempotencyKey requirement, the 500-line cap, and the tenant/client-pinned token scoping. However, those mechanics are also spelled out in the schema's parameter descriptions (preview, previewReceipt, idempotencyKey), so the description's marginal contribution over structured data is smaller than it first appears. It adds the pricing/lead-time cascades and costSource disclosure, which is genuine value beyond the annotations.

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 action and draft semantics, then constraints, then alternatives — a sensible ordering. The single dense paragraph is long and packs several cascades into long clauses, but every sentence carries decision-relevant information; nothing 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 10-parameter mutation with a two-step commit protocol, the description covers lifecycle state, preview/commit gating, idempotency, scoping by client-pinned token, line limits, defaulting behavior, and sibling routing. With an output schema present and 100% schema coverage, nothing an agent needs to call this correctly is missing.

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 above baseline by compressing the cost cascade (price book → catalog cost → last purchase cost, with each preview line naming its costSource), the payment-terms default to the vendor's standard terms, and the itemSku-vs-itemId mutual exclusivity. It doesn't add syntax or format detail beyond the schema for fields like expectedDate or supplierInvoiceNumber, 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 ("Create a forward PURCHASE ORDER to a vendor") and immediately pins the lifecycle state — a draft with status "created" that an operator later issues. It also distinguishes this from create_purchase_orders_from_recommendations and get_reorder_recommendations by name, so an agent can route without opening either schema.

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?

Explicit routing: use get_reorder_recommendations first, then create_purchase_orders_from_recommendations for a bulk reorder sweep, and "reach for this tool for an explicit, hand-built PO." It also gives a concrete decision rule for the ambiguous case where an item is named but no vendor — resolve from list_items' default vendor or list_item_sourcing_profiles, and only ask the user when there is no default or several plausible ones.

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