Generate Suggested Purchase Orders
generate_suggested_purchase_ordersDraft the purchase orders a manufacturing order's materials need, as the order screen's restock step does: its remaining lines are exploded through their bills of materials, and each material short at the order's warehouse (after on-hand stock, open purchase orders arriving by the planned start and drafts already made for this order, topped up to the reorder point) is ordered from its default supplier, one draft per supplier, due on the order's planned start. Name the order by id (GUID) or number. Without lines every suggested line is ordered as suggested; with lines exactly those (supplier, material) pairs are ordered at those quantities, each one a pair the suggestion lists. Quantities are in the material's inventory unit; a supplier set to sell it in a larger purchase unit gets that unit, rounded up. The preview lists each draft and the materials left out, with why. Nothing is sent to a supplier. Each draft goes through the tenant's purchase-order rules: one a rule holds for approval is listed in pendingApprovals (created once approved), one a rule refuses in rejected with the rule's message; when rules refuse every draft the commit fails with RULE_DENIED and nothing is created. Requires Write + replenishment.prepare on an unpinned operator credential. In-app assistants get a confirm card the user applies.
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": {
"manufacturingOrder": "<manufacturingOrder>"
},
"name": "generate_suggested_purchase_orders"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lines | No | Optional: the reviewed lines to order, 1–200, each a supplier and material pair from the preview with the quantity to order. Omit to order the whole suggestion. | |
| 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 changes until the commit call. | |
| 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. | |
| manufacturingOrder | Yes | The manufacturing order: its id (GUID) or its number, e.g. MO-001. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| result | No | ||
| preview | No | ||
| expiresAt | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| idempotentReplay | No |