Draft POs from Recommendations
create_purchase_orders_from_recommendationsConvert reorder recommendations into draft PURCHASE ORDERS in one call — the reorder→PO bridge. Runs the same canonical reorder detection as get_reorder_recommendations, takes its buy-from-vendor bucket, and creates draft POs GROUPED BY VENDOR AND WAREHOUSE (one PO per vendor per destination warehouse) at each item's current cost and suggested reorder quantity. Choose WHICH recommendations to convert with exactly one of: skus (convert these specific SKUs) OR minShortage (convert every purchase recommendation whose shortage is at least this many units — the "convert all above threshold" shape). Optionally scope the sweep with warehouseId and/or supplierId. Recommendations with no default vendor can't be bought and are returned in skipped. An item that an open draft PO already carries for that warehouse is also returned in skipped (DRAFT_PO_EXISTS, with the draft's number) instead of being drafted again: a draft is not on order yet, so the recommendation stays until it is issued. A client-pinned token only sees and buys for its own client. Draft POs still need an operator to issue them. Max 500 lines converted per call.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "create_purchase_orders_from_recommendations"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| skus | No | Convert these specific recommended SKUs. Provide exactly one of skus or minShortage. | |
| preview | No | Step 1 of the required two-step write: set true to validate and receive a structured preview of the per-vendor draft POs plus a single-use previewReceipt. Nothing is created until the commit call. | |
| supplierId | No | Optional vendor id (GUID) to scope the reorder sweep. | |
| minShortage | No | Convert every purchase recommendation whose shortage is at least this many units (>= 0). Provide exactly one of skus or minShortage. | |
| warehouseId | No | Optional warehouse id (GUID) to scope the reorder sweep. | |
| 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| preview | No | ||
| skipped | No | ||
| warnings | No | ||
| expiresAt | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| purchaseOrders | No | ||
| idempotentReplay | No | ||
| purchaseOrdersCreated | No | ||
| createdPurchaseOrderIds | No | ||
| recommendationsConverted | No |