get_product
Retrieve detailed product information from ShipBob's fulfillment system using a product ID to manage inventory and fulfillment operations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | The ID of the product to retrieve |
Implementation Reference
- src/tools/product-tools.js:37-52 (handler)The main handler function for the 'get_product' MCP tool. It takes a productId, calls shipbobClient.getProduct(productId), and returns the product details as JSON or an error message.handler: async ({ productId }) => { try { const product = await shipbobClient.getProduct(productId); return { content: [{ type: "text", text: JSON.stringify(product, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving product: ${error.message}` }], isError: true }; } }
- src/tools/product-tools.js:34-36 (schema)Zod input schema for the 'get_product' tool, defining the required 'productId' parameter as a string.schema: { productId: z.string().describe("The ID of the product to retrieve") },
- src/server.js:23-32 (registration)Utility function that registers each tool in a tools array (like productTools containing 'get_product') to the MCP server using server.tool(name, schema, handler, description).const registerTools = (toolsArray) => { toolsArray.forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); }); };
- src/server.js:50-50 (registration)Specific registration call for productTools array, which includes the 'get_product' tool.registerTools(productTools);
- src/api-client.js:59-61 (helper)ShipBob API client method invoked by the tool handler to perform the actual GET request to /products/{id} endpoint.async getProduct(id) { return this.request('GET', `/products/${id}`); }