stock_item_adjust
Move stock in or out by id or item name, in one atomic write with its movements-ledger row: stock-out clamps at zero (never negative) and applied_quantity reports what actually moved. An unmatched name CREATES the item at quantity 0 first so the delivery still lands as an audited ledger row; a name matching multiple active items refuses with the candidate ids. Concurrent adjusts on the same item retry instead of losing a write. NEXT: stock_item_list to see the item's updated balance in the full inventory.
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": {
"type": "<type>",
"quantity": "<quantity>"
},
"name": "stock_item_adjust"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The stock item id. | |
| name | No | No id? Resolve-or-create by item name: a unique active match resolves; an unknown name CREATES the item at quantity 0 and the adjustment lands as its first ledger row. | |
| type | Yes | "in" | "out" — also accepts received/delivery/restock (→ in) and sold/used (→ out). | |
| unit | No | ||
| notes | No | Free-form note recorded on the movements-ledger row. | |
| reason | No | Why the stock moved — recorded on the movements-ledger row. | |
| category | No | ||
| quantity | Yes | Whole units — count whole units: 24 bags → 24 (the digit string "24" also works). | |
| is_active | No | ||
| item_name | No | Alias of name. | |
| expiry_date | No | ||
| occurred_at | No | When the stock ACTUALLY moved (business time): "YYYY-MM-DD" or epoch milliseconds. Omitted = now. Backdated deliveries stay distinguishable from entry time. | |
| sell_price_cents | No | ||
| cost_per_unit_cents | No | ||
| low_stock_threshold | No |