Skip to main content
Glama

Revalue Stock Cost

revalue_stock_cost
Idempotent

Correct the unit cost of stock that is already on hand, without moving any units: for stock that came in without a receipt (a direct add with adjust_stock, a stock-level set, an import) at the wrong cost. Re-values that stock to the cost it should have come in at; units already sold or removed from it are re-valued too, on the account they left through. A connected ledger gets one correction journal set against Inventory Adjustment. Does not change the item's catalog cost (upsert_items does that, and it only values stock that came in at $0). Stock received on a purchase order's delivery receipt is refused: correct its cost on that receipt in the app. Each call re-values one cost layer of one item; when the item has more than one eligible layer, the refusal lists them and costLayerId picks one. Two-step: preview=true, then repeat the identical call with the previewReceipt and a fresh idempotencyKey. Requires Write + inventory.execute.

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": {
      "item": "<item>",
      "unitCost": "<unitCost>",
      "reason": "<reason>"
    },
    "name": "revalue_stock_cost"
  }
}

Input Schema

NameRequiredDescriptionDefault
itemYesItem id (GUID) or SKU whose stock to re-value.
reasonYesWhy the cost is being corrected (e.g. "Landed cost corrected from supplier invoice"), up to 500 characters. Kept on the correction record.
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.
unitCostYesThe unit cost the stock should carry, in the account's currency (e.g. 0.2427). Must differ from the cost it carries now.
costLayerIdNoOptional: the cost layer (GUID) to re-value, when the item holds more than one eligible layer. Omit it when the item has exactly one.
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
effectsNo
previewNo
nextStepNo
expiresAtNo
revaluationNo
actionItemIdNo
confirmationNo
correlationIdNo
approvalResultNo
idempotencyKeyNo
previewReceiptNo
idempotentReplayNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior4/5

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

Beyond the annotations, it discloses that already-sold or removed units are re-valued on the account they left through, that a connected ledger receives one Inventory Adjustment journal, and that it requires Write + inventory.execute. The refusal behavior for purchase-order receipts and multi-layer items is also stated. Slight gap: it never says whether the correction is reversible or how to undo a wrong revaluation.

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?

Purpose and scope are front-loaded, then exceptions, then the two-step mechanics and permissions. The prose is dense but each sentence carries a distinct operational fact. Minor cost: the middle sentences pack refusals, ledger effects, and layer selection together, making it slower to scan than it could 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 7-parameter mutation with an output schema, the description covers everything an agent needs: eligibility, exclusions, the mandatory preview/commit sequence, layer disambiguation, ledger side effects, and authorization requirements. Nothing material is left to inference.

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 genuine meaning: costLayerId is only needed when the refusal lists multiple eligible layers, previewReceipt must be paired with a fresh idempotencyKey, and reason is retained on the correction record. These are workflow semantics the schema fields state only partially.

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 opening clause gives a specific verb and resource ('Correct the unit cost of stock that is already on hand') plus the key scope constraint ('without moving any units'). It explicitly separates itself from adjust_stock (how the bad cost got there), upsert_items (catalog cost), and purchase-order receipts, so an agent can choose it without opening another schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It names the exact situations that qualify (direct add via adjust_stock, stock-level set, import) and the ones that do not (delivery-receipt stock must be fixed on the receipt in the app; catalog cost belongs to upsert_items). The two-step preview-then-commit sequence and the costLayerId fallback path are spelled out as procedure.

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