Skip to main content
Glama

Forthcast Inventory

Calculate order quantity

calculate_order_quantity
Read-onlyIdempotent

Use this when someone asks how many units to order, given demand, lead time, stock on hand and on order, and supplier rules such as MOQ, case pack or a minimum order value. Sizes the line the way Forthcast sizes a purchase-order line and lists every rule that changed the quantity. Works without a connected store.

Input Schema

NameRequiredDescriptionDefault
moqNoSupplier minimum order quantity for this item.
on_handYesUnits available now.
on_orderNoUnits already on open purchase orders.
case_packNoUnits per case; quantity is rounded up to whole cases.
unit_costNoPurchase cost per unit.
daily_demandNoDaily units sold, oldest first, 14 to 365 values.
service_levelNoTarget in-stock probability, 0.50 to 0.99.
lead_time_daysYesSupplier lead time in days.
min_order_valueNoSupplier minimum order value in currency; needs unit_cost.
demand_std_dailyNoStandard deviation of daily demand, if known.
cover_days_targetNoOptional explicit days of cover to buy instead of the default weeks-of-supply target.
average_daily_demandNoAverage units sold per day, if no daily history.

Output Schema

NameRequiredDescriptionDefault
positionYes
shortfallYes
assumptionsYes
connect_hintNoHow to get this done automatically on live store data.Forthcast does this automatically for Shopify stores: https://apps.shopify.com/forthcast
raw_quantityYes
safety_stockYes
reorder_pointYes
rules_appliedYes
estimated_costNo
value_categoryYes
demand_categoryYes
lead_time_categoryYes
suggested_quantityYes
weeks_of_supply_targetYes
days_of_cover_after_deliveryNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover read-only, idempotent, non-destructive and closed-world behavior. The description adds genuinely new behavior: it mirrors Forthcast's PO-line sizing and returns the list of rules that changed the quantity, plus that it works without a connected store — useful for an agent reasoning about a no-store setup.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two dense sentences with the trigger front-loaded and no redundant restatement of the name or title. Every clause adds routing or behavioral information.

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?

With a full output schema and annotations present, the description only needs to orient the caller, which it does by explaining the sizing model and the rule-change output. Minor gap: it doesn't hint at precedence among inputs (e.g. daily_demand vs average_daily_demand), though the schema partly covers this.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% across 12 parameters, so per-field meaning (including that min_order_value needs unit_cost, and case_pack rounding) is already documented. The description gestures at the same inputs without adding new semantics, so the baseline 3 applies.

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?

Names a specific verb and resource ('how many units to order') and immediately enumerates the inputs that size the line (demand, lead time, stock on hand/on order, supplier rules). This is clearly distinguishable from siblings like calculate_reorder_point or get_reorder_recommendations.

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?

The opening clause 'Use this when someone asks how many units to order' gives an explicit trigger condition. It does not, however, explicitly exclude the sibling reorder-point or recommendation tools, so an agent must infer which one to pick in overlapping cases.

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