Skip to main content
Glama

Mango Inventory

Adjust stock

adjust_stock
Destructive

Correct a quantity-tracked item's stock at ONE location: "we used up 12 batteries", "50 arrived", "recounted: there are 7". Exactly one of delta (relative: negative = used up, positive = received) or setTo (absolute recount). kind states the intent (usage | receipt | correction; inferred from the argument shape when absent); reason is a short note for the activity timeline. A negative delta past the location's unreserved stock is rejected (the error names the amounts); a setTo recount always records the count, even below reservations. A restock task opens automatically when a location's AVAILABLE stock (on hand minus what active orders reserved) drops below its threshold, so a location can be low with a full shelf. The result returns every stocked level as distribution: { locationId, name, kind: location|person, quantity, available, reserved?, minStock?, isLow? }, the same row shape check_item_availability returns, so isLow shows whether this adjustment took the location under its threshold. transfer_stock moves stock between locations; serialized items change through assign_item and set_item_status. Requires the manager role. Not idempotent: a repeated delta applies twice (a repeated setTo does not change the count again).

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": {
      "itemId": "<itemId>",
      "locationId": "<locationId>"
    },
    "name": "adjust_stock"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoIntent for the activity timeline; inferred from the argument shape when absent
deltaNoRelative change: negative = used up, positive = received (exactly one of delta/setTo)
setToNoAbsolute recount — the new quantity at this location
itemIdYesItem id (must be a quantity-tracked item)
reasonNoShort reason, shown in the item's activity timeline
locationIdYesLocation (or stock-holding person) resource id, from search_resources or check_item_availability's distribution

Output Schema

NameRequiredDescriptionDefault
nameNoItem name
itemIdNoItem id
distributionNoEvery stocked level after the change — the SAME row shape check_item_availability returns
totalQuantityNoPool total after the change
newLevelQuantityNoThe adjusted location's stock after the change

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • changedInput schema / properties / kind / description
      Previous value: -"Intent for the activity timeline; inferred from the argument shape when omitted"New value: +"Intent for the activity timeline; inferred from the argument shape when absent"
    • changedInput schema / properties / locationId / description
      Previous value: -"Location (or stock-holding person) resource id — find with search_resources or check_item_availability's distribution"New value: +"Location (or stock-holding person) resource id, from search_resources or check_item_availability's distribution"
    • changedOutput schema / properties / distribution / items / properties / available / description
      Previous value: -"Freely usable stock: quantity minus reserved, floored at 0. Always present — this is the number to act on"New value: +"Freely usable stock: quantity minus reserved, floored at 0. Always present"
    • changedOutput schema / properties / distribution / items / properties / locationName / description
      Previous value: -"DEPRECATED — the same string as `name`, kept only for clients whose tool list froze before the rename. Read `name`"New value: +"DEPRECATED — the same string as `name`, kept only for clients whose tool list froze before the rename"
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes well beyond the annotations: it explains the validation failure mode (negative delta past unreserved stock is rejected, error names amounts), that setTo always records even below reservations, that a restock task auto-opens on AVAILABLE stock, and precisely how non-idempotency manifests ('a repeated delta applies twice (a repeated setTo does not change the count again)'). That last point directly enriches the idempotentHint=false annotation with actionable detail.

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 zero filler sentences, but it is a single dense paragraph mixing semantics, error behavior, return shape, and alternatives; splitting it would improve scanability without cutting any content.

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, non-idempotent mutation with six parameters, it covers preconditions, failure modes, side effects (restock task), and even restates the return row shape and how isLow should be read. Nothing an agent needs to call this safely is missing.

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% and already carries most semantics, so the baseline is 3; the description earns an extra point by explaining how delta and setTo relate operationally (relative vs absolute, and their divergent rejection/idempotency behavior) and by framing delta in real-world terms ('we used up 12 batteries').

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 the specific verb and resource ('correct a quantity-tracked item's stock at ONE location') and grounds it in three concrete example scenarios, which pins down the operation far better than the title alone.

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?

Explicitly routes away from siblings: 'transfer_stock moves stock between locations; serialized items change through assign_item and set_item_status.' It also states the precondition (manager role) and the delta-vs-setTo selection rule.

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