get_product_inventory
Retrieve current stock levels for a specific product in the ShipBob fulfillment system to manage inventory and prevent overselling.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | The ID of the product to check inventory for |
Implementation Reference
- src/tools/inventory-tools.js:37-51 (handler)The main handler function for the 'get_product_inventory' tool. It fetches inventory data for a specific product using shipbobClient and returns formatted JSON or an error response.handler: async ({ productId }) => { try { const inventory = await shipbobClient.getInventoryByProduct(productId); return { content: [{ type: "text", text: JSON.stringify(inventory, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving product inventory: ${error.message}` }], isError: true }; }
- src/tools/inventory-tools.js:34-36 (schema)Input schema for the tool using Zod, requiring a productId string.schema: { productId: z.string().describe("The ID of the product to check inventory for") },
- src/server.js:52-52 (registration)Registers the inventoryTools array (which includes get_product_inventory) with the MCP server using the generic registerTools function.registerTools(inventoryTools);
- src/server.js:3-6 (registration)Imports inventoryTools from tools/index.js, which re-exports from inventory-tools.js.import { productTools, orderTools, inventoryTools,
- src/tools/index.js:3-3 (registration)Re-exports inventoryTools for convenient import in server.js.export { inventoryTools } from './inventory-tools.js';