Skip to main content
Glama

Generate Suggested Purchase Orders

generate_suggested_purchase_orders

Draft 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

NameRequiredDescriptionDefault
linesNoOptional: 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.
previewNoStep 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.
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.
manufacturingOrderYesThe manufacturing order: its id (GUID) or its number, e.g. MO-001.

Output Schema

NameRequiredDescriptionDefault
okNo
resultNo
previewNo
expiresAtNo
actionItemIdNo
confirmationNo
correlationIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only say it is a non-read-only, non-destructive, non-idempotent closed-world write; the description adds substantial context beyond that: nothing is transmitted externally, quantities are converted up to a supplier's purchase unit, preview is required before commit, drafts flow through tenant PO rules that yield pendingApprovals, rejected, or a RULE_DENIED failure with nothing created, and it requires Write + replenishment.prepare on an unpinned operator credential. That is a strong behavioral picture for a mutation tool, with only minor gaps such as partial-approval edge cases.

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 core action and dense but nearly waste-free; every clause carries operational meaning. It suffers slightly from being one long compound paragraph and repeats the id-or-number parameter detail already in the schema, which costs a bit of scannability.

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 five-parameter, rules-governed write tool with an output schema, the description covers the decision logic, the two-step write requirement, the auth preconditions, and the outcome branches (pending approval, rejection, RULE_DENIED). An agent has everything needed to call it correctly without opening the schema.

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 would be 3, but the description adds meaning the schema does not: manufacturingOrder accepts an id or number, lines must be (supplier, material) pairs drawn from the suggestion with quantities in the material's inventory unit, and the preview lists drafts plus excluded materials and reasons. The preview/previewReceipt two-step is described in both places, so it is partly redundant.

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 ('Draft the purchase orders a manufacturing order's materials need') and defines the derivation precisely: BOM explosion, shortage netting against on-hand, open POs, and existing drafts, reorder-point top-up, one draft per default supplier. This is distinguishable from generic purchase-order siblings like create_purchase_order or issue_purchase_order because it is explicitly a suggestion-only draft.

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 clear when-to-use context (restock step of a manufacturing order), explains the two modes (omit lines vs. supply reviewed lines) and steers that each supplied pair must come from the suggestion. It also makes the key exclusion explicit — 'Nothing is sent to a supplier' — implying that issuing is a separate step. It stops short of naming the alternative tool to call for issuing or for manual PO creation.

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