get_product_reviews
Retrieve product reviews from Klaviyo using filters and pagination for analyzing customer feedback and improving marketing strategies.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_product_reviews"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter query for product reviews | |
| page_size | No | Number of reviews per page (1-100) | |
| page_cursor | No | Cursor for pagination |
Implementation Reference
- src/tools/reviews.js:13-25 (handler)Handler function that executes the get_product_reviews tool logic: fetches reviews using klaviyoClient and returns formatted JSON or error response.
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)Zod input schema defining optional parameters: filter, page_size, and page_cursor for the get_product_reviews tool.
{ 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 registration.
registerReviewTools(server);