list_products
Retrieve product listings from ShipBob's fulfillment system with pagination and search filters to manage inventory efficiently.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination | |
| limit | No | Number of products per page | |
| search | No | Search term to filter products |
Implementation Reference
- src/tools/product-tools.js:13-28 (handler)The handler function for the 'list_products' tool. It constructs parameters from input, calls shipbobClient.getProducts(), formats the response as JSON text, and handles errors.handler: async ({ page, limit, search }) => { try { const params = { page, limit, search }; const products = await shipbobClient.getProducts(params); return { content: [{ type: "text", text: JSON.stringify(products, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error listing products: ${error.message}` }], isError: true }; }
- src/tools/product-tools.js:8-12 (schema)Zod schema defining optional input parameters for the list_products tool: page, limit, and search.schema: { page: z.number().optional().describe("Page number for pagination"), limit: z.number().optional().describe("Number of products per page"), search: z.string().optional().describe("Search term to filter products") },
- src/server.js:50-50 (registration)Registers the productTools array (containing list_products and other product tools) with the MCP server using the registerTools utility.registerTools(productTools);
- src/server.js:23-32 (registration)Utility function used to register each tool from an array to the MCP server by calling server.tool() for name, schema, handler, and description.const registerTools = (toolsArray) => { toolsArray.forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); }); };