get_inventory
Retrieve inventory data from ShipBob's fulfillment system to track stock levels, manage product availability, and monitor warehouse quantities across fulfillment centers.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| limit | No | Number of items per page | |
| fulfillmentCenterId | No | Filter by fulfillment center ID |
Implementation Reference
- src/tools/inventory-tools.js:13-29 (handler)The handler function that implements the core logic of the 'get_inventory' tool by fetching inventory data from ShipBob API and returning it as formatted JSON text or an error message.handler: async ({ page, limit, fulfillmentCenterId }) => { try { const params = { page, limit, fulfillmentCenterId }; const inventory = await shipbobClient.getInventory(params); return { content: [{ type: "text", text: JSON.stringify(inventory, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving inventory: ${error.message}` }], isError: true }; } }
- src/tools/inventory-tools.js:8-12 (schema)Zod schema defining the input parameters for the 'get_inventory' tool: optional page, limit, and fulfillmentCenterId.schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of items per page"), fulfillmentCenterId: z.string().optional().describe("Filter by fulfillment center ID") },
- src/tools/inventory-tools.js:5-30 (registration)The complete tool definition object for 'get_inventory' within the exported inventoryTools array.{ name: "get_inventory", description: "Get inventory information across all fulfillment centers", schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of items per page"), fulfillmentCenterId: z.string().optional().describe("Filter by fulfillment center ID") }, handler: async ({ page, limit, fulfillmentCenterId }) => { try { const params = { page, limit, fulfillmentCenterId }; const inventory = await shipbobClient.getInventory(params); return { content: [{ type: "text", text: JSON.stringify(inventory, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving inventory: ${error.message}` }], isError: true }; } } },
- src/server.js:52-52 (registration)Registration of the inventoryTools array (containing 'get_inventory') with the MCP server via the registerTools utility function.registerTools(inventoryTools);
- src/api-client.js:89-91 (helper)ShipBobClient helper method that performs the underlying API GET request to the '/inventory' endpoint.async getInventory(params) { return this.request('GET', '/inventory', null, params); }