Skip to main content
Glama
mattcoatsworth

ShipStation API MCP Server

get_product

Retrieve product details from ShipStation using a product ID to manage inventory, fulfill orders, and update product information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdYesProduct ID to retrieve

Implementation Reference

  • 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
        };
      }
    }
  • Zod schema defining the input parameter 'productId' as a required number.
    schema: {
      productId: z.number().describe("Product ID to retrieve")
    },
  • 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 }
      );
    });
  • 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}`);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mattcoatsworth/shipstation-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server