list-products
Retrieve product details from a specific cluster on Novita MCP Server. Use cluster ID to fetch products, optionally filter by product name for targeted results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clusterId | No | ID of the cluster to list products from. You can use the `list-clusters` tool to get the cluster ID. | |
| productName | No | Name of the product to filter by. |
Implementation Reference
- src/tools.ts:40-58 (handler)Handler function executing the tool logic: builds optional query parameters for clusterId and productName, fetches products from /products endpoint using novitaRequest, and returns formatted JSON response.}, async (params) => { const queryParams = new URLSearchParams(); if (params.clusterId) queryParams.append("clusterId", params.clusterId); if (params.productName) queryParams.append("productName", params.productName); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ""; const result = await novitaRequest(`/products${queryString}`); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; });
- src/tools.ts:32-39 (schema)Input schema using Zod for validation of parameters: optional clusterId and productName strings with descriptions.clusterId: z .string() .optional() .describe("ID of the cluster to list products from. You can use the `list-clusters` tool to get the cluster ID."), productName: z .string() .optional() .describe("Name of the product to filter by."),
- src/tools.ts:31-58 (registration)Direct registration of the 'list-products' tool on the McpServer instance within registerProductTools function, specifying name, input schema, and handler.server.tool("list-products", { clusterId: z .string() .optional() .describe("ID of the cluster to list products from. You can use the `list-clusters` tool to get the cluster ID."), productName: z .string() .optional() .describe("Name of the product to filter by."), }, async (params) => { const queryParams = new URLSearchParams(); if (params.clusterId) queryParams.append("clusterId", params.clusterId); if (params.productName) queryParams.append("productName", params.productName); const queryString = queryParams.toString() ? `?${queryParams.toString()}` : ""; const result = await novitaRequest(`/products${queryString}`); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; });
- src/index.ts:23-23 (registration)Main server setup calls registerAllTools(server), which in turn calls registerProductTools to register the list-products tool among others.registerAllTools(server);