get_inventory
Retrieve inventory data from ShipBob's fulfillment API by specifying page, limit, and fulfillment center ID for efficient stock management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fulfillmentCenterId | No | Filter by fulfillment center ID | |
| limit | No | Number of items per page | |
| page | No | Page number for pagination |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"fulfillmentCenterId": {
"description": "Filter by fulfillment center ID",
"type": "string"
},
"limit": {
"description": "Number of items per page",
"type": "number"
},
"page": {
"description": "Page number for pagination",
"type": "number"
}
},
"type": "object"
}
Implementation Reference
- src/tools/inventory-tools.js:13-29 (handler)The handler function that implements the core logic of the 'get_inventory' tool. It constructs parameters, calls the ShipBob API via shipbobClient.getInventory, formats the response as JSON text, and handles errors.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 for pagination, and fulfillmentCenterId filter.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/server.js:52-52 (registration)Calls registerTools on inventoryTools, which iterates over the tools array (including 'get_inventory') and registers each with the MCP server using server.tool(name, schema, handler).registerTools(inventoryTools);
- src/api-client.js:89-91 (helper)ShipBobClient method called by the tool handler to fetch inventory data from the ShipBob API endpoint '/inventory'.async getInventory(params) { return this.request('GET', '/inventory', null, params); }