get_product_inventory
Retrieve real-time inventory data for a specific product using its ID, enabling accurate stock management via the ShipBob API MCP Server.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | The ID of the product to check inventory for |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"productId": {
"description": "The ID of the product to check inventory for",
"type": "string"
}
},
"required": [
"productId"
],
"type": "object"
}
Implementation Reference
- src/tools/inventory-tools.js:37-53 (handler)The async handler function that executes the tool logic: fetches product inventory via shipbobClient and returns JSON response or error.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)Zod input schema defining the required productId parameter.schema: { productId: z.string().describe("The ID of the product to check inventory for") },
- src/server.js:52-52 (registration)Calls registerTools with inventoryTools array, which registers the get_product_inventory tool (along with others) to the MCP server.registerTools(inventoryTools);
- src/api-client.js:93-95 (helper)ShipBobClient method supporting the handler by making the API request to retrieve inventory for the given product ID.async getInventoryByProduct(productId) { return this.request('GET', `/inventory/products/${productId}`); }