Create Purchase Order
create_purchase_orderCreate 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
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Optional free-text note stored on the PO. | |
| lines | Yes | The lines to order (max 500). Each names an item and a quantity. | |
| preview | No | Step 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. | |
| supplierId | Yes | Vendor id (GUID) to buy from — must be an existing vendor on this tenant. | |
| expectedDate | No | Optional 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). | |
| paymentTerms | No | Optional payment terms printed on the order (e.g. Net 30). Omit to use the vendor's standard terms. | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 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. | |
| supplierInvoiceNumber | No | Optional vendor invoice/reference number. | |
| destinationWarehouseId | Yes | Destination warehouse id (GUID) where the goods will be received. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| dueAt | No | ||
| number | No | ||
| status | No | ||
| preview | No | ||
| clientId | No | ||
| warnings | No | ||
| expiresAt | No | ||
| lineCount | No | ||
| supplierId | No | ||
| totalAmount | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| supplierName | No | ||
| correlationId | No | ||
| totalQuantity | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| purchaseOrderId | No | ||
| idempotentReplay | No |