get_product
Retrieve product details from ShipStation using a product ID to manage inventory, fulfill orders, and update product information.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| productId | Yes | Product ID to retrieve |
Implementation Reference
- src/tools/product-tools.js:38-50 (handler)The main handler function for the 'get_product' tool. It fetches the product details from ShipStation API using the provided productId and returns the JSON-formatted response or an error message.handler: async ({ productId }) => { try { const product = await shipStationClient.getProduct(productId); return { content: [{ type: "text", text: JSON.stringify(product, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } }
- src/tools/product-tools.js:35-37 (schema)Zod schema defining the input parameter 'productId' as a required number.schema: { productId: z.number().describe("Product ID to retrieve") },
- src/tools/product-tools.js:32-51 (registration)The complete tool definition object including name, description, schema, and handler, which is exported and later registered in the MCP server.{ name: "get_product", description: "Get details for a specific product", schema: { productId: z.number().describe("Product ID to retrieve") }, handler: async ({ productId }) => { try { const product = await shipStationClient.getProduct(productId); return { content: [{ type: "text", text: JSON.stringify(product, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } } },
- src/server.js:174-191 (registration)Registration loop where all tools, including those from productTools (containing 'get_product'), are registered with the MCP server using server.tool().[ ...orderTools, ...shipmentTools, ...carrierTools, ...warehouseTools, ...productTools, ...customerTools, ...storeTools, ...webhookTools, ...fulfillmentTools ].forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); });
- src/api-client.js:140-141 (helper)Helper method in ShipStationClient that makes the API request to retrieve a specific product by ID, called by the tool handler.async getProduct(productId) { return this.request('GET', `/products/${productId}`);