get_product
Retrieve detailed product information from ShipBob's e-commerce fulfillment API by specifying the product ID. Ideal for managing inventory and fulfillment processes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | The ID of the product to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"productId": {
"description": "The ID of the product to retrieve",
"type": "string"
}
},
"required": [
"productId"
],
"type": "object"
}
Implementation Reference
- src/tools/product-tools.js:37-52 (handler)The handler function that implements the core logic of the 'get_product' tool. It fetches the product details using shipbobClient.getProduct and returns a formatted JSON response 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 schema defining the input parameter 'productId' for the 'get_product' tool.schema: { productId: z.string().describe("The ID of the product to retrieve") },
- src/tools/product-tools.js:31-52 (registration)The complete tool definition object for 'get_product', which is part of the productTools array exported and later registered with the MCP server.{ name: "get_product", description: "Get details of a specific product by ID", schema: { productId: z.string().describe("The ID of the product to retrieve") }, 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/server.js:50-50 (registration)Registration call that registers all tools from productTools (including 'get_product') with the MCP server via server.tool().registerTools(productTools);
- src/api-client.js:59-61 (helper)Helper method in ShipBobClient that performs the actual API request to retrieve a product by ID, used by the tool handler.async getProduct(id) { return this.request('GET', `/products/${id}`); }