get_list
Retrieve a specific email marketing list from Klaviyo using its unique ID to access subscriber data and manage audience segments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the list to retrieve |
Implementation Reference
- src/tools/lists.js:31-49 (registration)Registers the 'get_list' MCP tool on the server with input schema, handler function, and description."get_list", { id: z.string().describe("ID of the list to retrieve") }, async (params) => { try { const list = await klaviyoClient.get(`/lists/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(list, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving list: ${error.message}` }], isError: true }; } }, { description: "Get a specific list from Klaviyo" } );
- src/tools/lists.js:35-47 (handler)The handler function that implements the core logic of the 'get_list' tool: fetches the list by ID from Klaviyo API and returns JSON response or error.async (params) => { try { const list = await klaviyoClient.get(`/lists/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(list, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving list: ${error.message}` }], isError: true }; } },
- src/tools/lists.js:32-34 (schema)Zod input schema for the 'get_list' tool, requiring a string 'id' parameter.{ id: z.string().describe("ID of the list to retrieve") },