get_inventory_levels
Retrieve current inventory levels from ShipBob's fulfillment system to monitor stock quantities and manage product availability across warehouses.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| limit | No | Number of items per page |
Implementation Reference
- src/tools/inventory-tools.js:61-77 (handler)The handler function that executes the tool logic: prepares params, calls shipbobClient.getInventoryLevels, returns formatted JSON or error response.handler: async ({ page, limit }) => { try { const params = { page, limit }; const levels = await shipbobClient.getInventoryLevels(params); return { content: [{ type: "text", text: JSON.stringify(levels, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving inventory levels: ${error.message}` }], isError: true }; } }
- src/tools/inventory-tools.js:57-60 (schema)Zod schema defining optional input parameters: page and limit for pagination.schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of items per page") },
- src/tools/inventory-tools.js:54-78 (registration)Tool definition object in inventoryTools array, which is imported and registered via server.tool() in server.js.{ name: "get_inventory_levels", description: "Get current inventory levels for all products", schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of items per page") }, handler: async ({ page, limit }) => { try { const params = { page, limit }; const levels = await shipbobClient.getInventoryLevels(params); return { content: [{ type: "text", text: JSON.stringify(levels, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving inventory levels: ${error.message}` }], isError: true }; } } },
- src/api-client.js:97-99 (helper)ShipBobClient helper method that performs the actual API GET request to retrieve inventory levels.async getInventoryLevels(params) { return this.request('GET', '/inventory/levels', null, params); }