Set Inventory Levels
set_inventory_levelsSet ABSOLUTE on-hand inventory levels at an Internal (managed) warehouse — the opening-stock step of tenant onboarding, after import_historical_sales_orders has seeded the catalog. Each line sets the item's on-hand to the given quantity (not a delta) at the warehouse's default location, with a full audit trail and cost layers. Items not listed are left untouched, so chunking a large catalog across calls is safe, and re-sending the same levels is a no-op. Provide unitCost for items whose cost is unknown to Spark (e.g. seeded from order history) so COGS and carrying-cost math work. Max 500 lines per call.
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": {
"levels": "<levels>"
},
"name": "set_inventory_levels"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| levels | Yes | Inventory levels to set (max 500 per call). | |
| preview | No | Step 1 of the required two-step write: set true to validate, resolve the identifiers, and receive a structured preview of the resolved absolute targets plus a single-use previewReceipt. Nothing is written until the commit call. | |
| clientId | No | Optional client id (GUID) for operator (unpinned) credentials on 3PL tenants: confines SKU/UPC matching to that client's items — get ids from list_clients. Client-pinned credentials omit this; the credential decides. | |
| warehouseId | No | Optional Internal warehouse id (GUID). May be omitted when the tenant has exactly one Internal warehouse. | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 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
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| errors | No | ||
| failed | No | ||
| applied | No | ||
| preview | No | ||
| skipped | No | ||
| warnings | No | ||
| expiresAt | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| idempotentReplay | No | ||
| projectionsPending | No | ||
| skippedIdentifiers | No |