list_products
Fetch and filter product data from ShipStation API by SKU, name, category, or status. Control pagination, sorting, and include inactive products for streamlined inventory management.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Filter by product name | |
| page | No | Page number | |
| pageSize | No | Number of products per page (max 500) | |
| productCategoryId | No | Filter by product category ID | |
| showInactive | No | Include inactive products | |
| sku | No | Filter by SKU | |
| sortBy | No | Sort products by a specific field | |
| sortDir | No | Sort direction |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"name": {
"description": "Filter by product name",
"type": "string"
},
"page": {
"description": "Page number",
"type": "number"
},
"pageSize": {
"description": "Number of products per page (max 500)",
"type": "number"
},
"productCategoryId": {
"description": "Filter by product category ID",
"type": "number"
},
"showInactive": {
"description": "Include inactive products",
"type": "boolean"
},
"sku": {
"description": "Filter by SKU",
"type": "string"
},
"sortBy": {
"description": "Sort products by a specific field",
"type": "string"
},
"sortDir": {
"description": "Sort direction",
"enum": [
"ASC",
"DESC"
],
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- src/tools/product-tools.js:18-30 (handler)The handler function that implements the core logic of the 'list_products' tool. It fetches products using shipStationClient.getProducts(params) and returns a JSON-formatted response or an error message.handler: async (params) => { try { const products = await shipStationClient.getProducts(params); return { content: [{ type: "text", text: JSON.stringify(products, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: error.message }], isError: true }; } }
- src/tools/product-tools.js:8-17 (schema)Zod schema defining the input parameters for the list_products tool, including optional filters for pagination, sorting, SKU, name, category, and inactive products.schema: { page: z.number().optional().describe("Page number"), pageSize: z.number().optional().describe("Number of products per page (max 500)"), sortBy: z.string().optional().describe("Sort products by a specific field"), sortDir: z.enum(["ASC", "DESC"]).optional().describe("Sort direction"), sku: z.string().optional().describe("Filter by SKU"), name: z.string().optional().describe("Filter by product name"), productCategoryId: z.number().optional().describe("Filter by product category ID"), showInactive: z.boolean().optional().describe("Include inactive products") },
- src/server.js:184-191 (registration)The MCP server registration loop that dynamically registers the 'list_products' tool (included via ...productTools spread at line 179) using server.tool with its name, schema, handler, and description.].forEach(tool => { server.tool( tool.name, tool.schema, tool.handler, { description: tool.description } ); });
- src/api-client.js:136-138 (helper)Helper method in ShipStationClient that handles the actual API request to retrieve products from the /products endpoint, passing parameters for filtering and pagination.async getProducts(params) { return this.request('GET', '/products', null, params); }