get_product_reviews
Extract and manage product reviews using filter queries, pagination, and customizable page sizes to streamline feedback analysis and marketing strategies.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter query for product reviews | |
| page_cursor | No | Cursor for pagination | |
| page_size | No | Number of reviews per page (1-100) |
Implementation Reference
- src/tools/reviews.js:13-25 (handler)The handler function that executes the tool logic: fetches product reviews from Klaviyo API using the klaviyoClient and formats the response or error.async (params) => { try { const reviews = await klaviyoClient.get('/product-reviews/', params); return { content: [{ type: "text", text: JSON.stringify(reviews, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving product reviews: ${error.message}` }], isError: true }; } },
- src/tools/reviews.js:8-12 (schema)Input schema (Zod) for the tool parameters: optional filter, page_size (1-100), and page_cursor.{ filter: z.string().optional().describe("Filter query for product reviews"), page_size: z.number().min(1).max(100).optional().describe("Number of reviews per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") },
- src/tools/reviews.js:7-27 (registration)Direct registration of the 'get_product_reviews' tool on the MCP server, including schema, handler, and description."get_product_reviews", { filter: z.string().optional().describe("Filter query for product reviews"), page_size: z.number().min(1).max(100).optional().describe("Number of reviews per page (1-100)"), page_cursor: z.string().optional().describe("Cursor for pagination") }, async (params) => { try { const reviews = await klaviyoClient.get('/product-reviews/', params); return { content: [{ type: "text", text: JSON.stringify(reviews, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving product reviews: ${error.message}` }], isError: true }; } }, { description: "Get product reviews from Klaviyo" } );
- src/server.js:47-47 (registration)Top-level call to registerReviewTools which includes the get_product_reviews tool.registerReviewTools(server);