get_profile
Retrieve a specific customer profile from Klaviyo using its unique ID to access contact details and marketing data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the profile to retrieve |
Implementation Reference
- src/tools/profiles.js:35-47 (handler)Handler function that executes the get_profile tool: fetches profile data from Klaviyo API by ID and returns formatted JSON response or error.async (params) => { try { const profile = await klaviyoClient.get(`/profiles/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(profile, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving profile: ${error.message}` }], isError: true }; } },
- src/tools/profiles.js:32-34 (schema)Input schema validation using Zod for the get_profile tool, requiring a string 'id' parameter.{ id: z.string().describe("ID of the profile to retrieve") },
- src/tools/profiles.js:30-49 (registration)Tool registration call within registerProfileTools function, defining name, schema, handler, and description for get_profile.server.tool( "get_profile", { id: z.string().describe("ID of the profile to retrieve") }, async (params) => { try { const profile = await klaviyoClient.get(`/profiles/${params.id}/`); return { content: [{ type: "text", text: JSON.stringify(profile, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving profile: ${error.message}` }], isError: true }; } }, { description: "Get a specific profile from Klaviyo" } );
- src/server.js:32-32 (registration)Invocation of registerProfileTools to register all profile-related tools, including get_profile, on the MCP server.registerProfileTools(server);