Skip to main content
Glama

Draft POs from Recommendations

create_purchase_orders_from_recommendations

Convert 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

NameRequiredDescriptionDefault
skusNoConvert these specific recommended SKUs. Provide exactly one of skus or minShortage.
previewNoStep 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.
supplierIdNoOptional vendor id (GUID) to scope the reorder sweep.
minShortageNoConvert every purchase recommendation whose shortage is at least this many units (>= 0). Provide exactly one of skus or minShortage.
warehouseIdNoOptional warehouse id (GUID) to scope the reorder sweep.
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.

Output Schema

NameRequiredDescriptionDefault
okNo
previewNo
skippedNo
warningsNo
expiresAtNo
actionItemIdNo
confirmationNo
correlationIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
purchaseOrdersNo
idempotentReplayNo
purchaseOrdersCreatedNo
createdPurchaseOrderIdsNo
recommendationsConvertedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: drafts are not yet on order, so recommendations persist in skipped with DRAFT_PO_EXISTS and the draft number; POs are priced at each item's current cost and suggested reorder quantity; client-pinned tokens are isolated; and there is a 500-line cap. The operator-issue requirement and the concrete skip taxonomy are exactly the mutation context the destructiveHint=false annotation cannot convey.

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-loads the core transformation, then the selection rule, then skip behavior and limits — a sensible priority order with no filler. It is long and slightly dense (all-caps emphasis, nested parentheticals), and the phrase "in one call" sits awkwardly against the schema's required preview-then-commit sequence.

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?

For a 7-parameter mutation with an output schema, the description covers selection, grouping, pricing, skipping, tenancy, and volume limits. Its one meaningful omission is the mandatory two-step preview/commit write, which lives only in the schema descriptions — and "in one call" arguably undercuts it.

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, but the description adds real semantics: the mutually exclusive skus/minShortage choice, the vendor-and-warehouse grouping that explains supplierId/warehouseId scoping, and the units- vs SKU-based selection modes. It does not restate the preview/previewReceipt handshake, but it is not needed to use the parameters correctly.

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+resource chain ("Convert reorder recommendations into draft PURCHASE ORDERS") and names the read-side sibling it mirrors (get_reorder_recommendations), plus the concrete output shape (one PO per vendor per destination warehouse). An agent can distinguish this from get_reorder_recommendations and from single-PO tools like create_purchase_order without opening the schema.

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 an explicit selection rule: exactly one of skus OR minShortage, with minShortage characterized as the "convert all above threshold" shape, plus optional warehouseId/supplierId scoping. It also explains skip conditions (no default vendor, existing draft). It stops short of naming when to prefer siblings such as generate_suggested_purchase_orders or create_purchase_order, so the alternative-selection guidance is incomplete.

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