Skip to main content
Glama

Apply Demand Curve to Items

apply_demand_curve_to_items
Destructive

Apply one demand curve to a batch of items (max 10,000 ids per call; item ids come from list_items) in a single idempotent action. The ids must belong to the targeted catalog: a client-pinned credential applies to its own client's items, and an operator (unpinned) credential applies to the house catalog unless clientId targets a client's items. Applications are Modulate-only: the mean-normalized shape re-times each item's forecast within the year but cannot change its annual total, which is what makes a catalog-scale application volume-safe — volume-setting (absolute) assignments are deliberately not available over MCP; a person sets volumes in the app. Items already carrying this curve are counted, not duplicated; items carrying a DIFFERENT curve are skipped unless overwriteExisting=true replaces them. Every created assignment is stamped source=McpTool with a sourceRef for provenance, and the response accounts for every requested id (matched/notFound/assigned/alreadyAssigned/replaced/skippedConflict).

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": {
      "curveId": "<curveId>",
      "itemIds": "<itemIds>"
    },
    "name": "apply_demand_curve_to_items"
  }
}

Input Schema

NameRequiredDescriptionDefault
noteNoOptional note on how the items were selected (e.g. the filter used) — stored as provenance on each created assignment.
curveIdYesThe demand curve id (GUID) to apply.
itemIdsYesItem ids (GUIDs) to apply it to, max 10,000 per call.
previewNoStep 1 of the required two-step write: set true to validate and receive a structured preview (matched / would-assign / would-replace counts) plus a single-use previewReceipt. Nothing is changed until the commit call.
clientIdNoOptional client id (GUID) for operator (unpinned) credentials on 3PL tenants: applies the curve to that client's items instead of the house catalog — get ids from list_clients. Client-pinned credentials omit this; the credential decides.
anchorDateNoOptional fallback anchor date for Lifecycle curves; each item's own launch date wins. Ignored for Seasonal curves.
warehouseIdNoOptional warehouse id (GUID) to apply the curve at a single warehouse only. Omitted = the assignment covers all warehouses.
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.
overwriteExistingNoWhen an item already carries a different curve, replace it instead of skipping it (default false = leave existing per-item choices untouched).

Output Schema

NameRequiredDescriptionDefault
okNo
countsNo
previewNo
expiresAtNo
sourceRefNo
actionItemIdNo
confirmationNo
correlationIdNo
demandCurveIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior2/5

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

The description is unusually rich about behavior the annotations do not cover — catalog scoping by credential type, no-duplicate counting, conflicts skipped unless overwriteExisting, source=McpTool provenance stamping, and per-id accounting categories. However, it explicitly calls the operation 'a single idempotent action' and says already-curved items are 'counted, not duplicated', which directly contradicts the idempotentHint=false annotation; an agent may wrongly believe blind retries are safe.

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?

Everything is front-loaded — action, limit, id source, then scoping and safety, then conflict handling — and nearly every clause carries real information (the volume-safety rationale is the only arguably expendable part). The downside is that it is delivered as one dense paragraph with long multi-clause sentences, making it harder to scan than it needs to be.

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 destructive, 10-parameter batch mutation with an output schema, the description covers the essentials an agent needs: batch limit, id provenance, credential/catalog scoping, the mandatory preview/commit protocol, conflict and overwrite behavior, and provenance stamping. Return-value detail is summarized despite an output schema existing, so nothing material is missing.

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%, so the schema already documents all ten parameters (preview/previewReceipt two-step, clientId credential rules, anchorDate applicability, warehouseId scope, overwriteExisting). The description corroborates and adds domain rationale (mean-normalized volume safety, provenance sourceRef) but supplies little parameter syntax or meaning that the schema does not already carry, so the baseline of 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?

The description opens with a specific verb, resource and scope: 'Apply one demand curve to a batch of items (max 10,000 ids per call)'. It further pins down the variant of the operation ('Modulate-only', mean-normalized shape) and explicitly rules out the volume-setting alternative, so an agent can tell exactly which of the demand-curve siblings this is.

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?

Strong context: item ids must come from list_items, clientId comes from list_clients, client-pinned credentials must omit clientId, and the write requires the preview → previewReceipt + idempotencyKey two-step flow. It also states what is NOT available over MCP (absolute volume-setting must be done in the app). The only gap is that it never points to list_demand_curves/suggest_curves_for_items for obtaining a curveId, so curve discovery is left implicit.

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