get_profile
Retrieve detailed customer profile data by specifying the profile ID, enabling efficient management of marketing automation and audience insights in Klaviyo.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the profile to retrieve |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"id": {
"description": "ID of the profile to retrieve",
"type": "string"
}
},
"required": [
"id"
],
"type": "object"
}
Implementation Reference
- src/tools/profiles.js:35-47 (handler)The async handler function for the 'get_profile' tool. Fetches the specific profile by ID from the Klaviyo API using klaviyoClient.get and returns a JSON-formatted response or an error message.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)Zod input schema defining the required 'id' parameter as a string for the get_profile tool.{ id: z.string().describe("ID of the profile to retrieve") },
- src/tools/profiles.js:31-49 (registration)Direct registration of the 'get_profile' tool via server.tool, specifying name, input schema, handler function, and description."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)Top-level registration call to registerProfileTools(server), which includes the registration of the get_profile tool.registerProfileTools(server);