get_list
Retrieve specific customer lists using an ID from the Klaviyo MCP Server. This tool simplifies accessing and managing list data for targeted marketing automation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the list to retrieve |
Implementation Reference
- src/tools/lists.js:35-47 (handler)Handler function that fetches the specified Klaviyo list by ID using klaviyoClient.get and returns formatted 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)Input validation schema for the 'get_list' tool using Zod, requiring a string 'id'.{ id: z.string().describe("ID of the list to retrieve") },
- src/tools/lists.js:31-49 (registration)Complete registration of the 'get_list' MCP tool, including name, schema, inline handler, 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/server.js:33-33 (registration)Invocation of registerListTools in the main server setup, which registers the 'get_list' tool among others.registerListTools(server);