Stock movements
stock_movementsThe stock movement ledger in bulk: every recorded change to on-hand quantity, across products, newest first. stock_level gives one product's quantity now; this gives what moved, when, why and the balance it left. A revaluation row has qtyDelta 0 and carries the new average cost in unitCost. Every filter is optional: product, from/to (on docDate) and sourceType. Each row: ts (posted), docDate (the document's date; a voided or edited bill's reversal keeps the bill's date, a voided credit or debit note's reversal takes the void date; with no document, the Malaysian posting day), product {sku, name}, qtyDelta (negative took stock out), balanceAfter (company-wide on-hand after the move), unitCost, reason, sourceType, sourceId (the document's id, as search_documents returns it), location on a multi-location company, and editReversal:true on a purchase_void or sale_void row written by an edit, not a void (when the edit kept the product, its repost is the purchase or sale row at the same ts). stockMode says how the company records stock. Under modified_periodic (companies created before 28 Sep 2026 unless switched) selling writes no movement row and stock is trued up at stock take, so missing sale rows are not missing sales or shrinkage; rows written while a company ran perpetual remain, and voiding a perpetually-booked document still writes its reversal row. A stock take at one location can write a pair of stock_take rows under one sourceId with opposite qtyDelta (one at the location, one at no location): the pair nets to zero and moves stock between shelves, not in or out. Capped at 200 rows with total, shown and more. Values are as recorded. It does not value inventory (balance_sheet), compute COGS or margin (income_statement, profit_drivers) or suggest reorders (low_stock).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "stock_movements"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Latest docDate, `YYYY-MM-DD` (the document date, else the Malaysian posting day). | |
| sku | No | Not a filter on this tool. Product text goes in `product`: one case-insensitive contains matched against both the product name and the SKU. | |
| date | No | Not a filter on this tool. The date window is `from` and/or `to` (`YYYY-MM-DD`); one day is `from` and `to` set to the same date. | |
| from | No | Earliest docDate, `YYYY-MM-DD` (the document date, else the Malaysian posting day). A narrower window splits a pull of more than 200 rows. | |
| item | No | Not a filter on this tool. Product text goes in `product`: one case-insensitive contains matched against both the product name and the SKU. | |
| name | No | Not a filter on this tool. Product text goes in `product`: one case-insensitive contains matched against both the product name and the SKU. | |
| type | No | Not a filter on this tool. The movement cause is `sourceType`. | |
| limit | No | Not a filter on this tool. The page size is fixed at 200 movements; `from`/`to`, `product` and `sourceType` narrow the pull. | |
| query | No | Not a filter on this tool. Product text goes in `product`: one case-insensitive contains matched against both the product name and the SKU. | |
| dateTo | No | Not a filter on this tool. The end of the window is `to`. | |
| reason | No | Not a filter on this tool. `reason` is the free text typed for a movement and comes back on each row; the cause filter is `sourceType` (e.g. `adjustment`). | |
| source | No | Not a filter on this tool. The movement cause is `sourceType`. | |
| product | No | Case-insensitive contains, matched against the product name or SKU. Omitted: every product. | |
| dateFrom | No | Not a filter on this tool. The start of the window is `from`. | |
| productId | No | Not a filter on this tool. This search matches product text, not ids; the name or SKU goes in `product`. | |
| sourceType | No | One movement cause: purchase, purchase_void, debit_note, debit_note_void, adjustment, stock_take, import_opening, assembly_out, assembly_in, disassembly_out, disassembly_in, sale, sale_void, credit_note, transfer_out, transfer_in, revaluation. Only perpetual stock creates sale, sale_void, credit_note rows; a company that switched to periodic keeps the ones it wrote. | |
| productName | No | Not a filter on this tool. Product text goes in `product`: one case-insensitive contains matched against both the product name and the SKU. |