get_subscriber_by_email
Retrieve subscriber details from a Sitecore Send mailing list using their email address to access contact information and engagement data.
Instructions
Get subscriber by email
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | Id of the mailing list | |
| Yes | Email of the subscriber |
Implementation Reference
- src/tools/api.ts:85-103 (handler)The execute function that implements the tool logic: fetches subscriber by email using the SendClient and returns formatted details or error.execute: async ({ listId, email }) => { try { const response = await client.subscribers.findByEmail(listId, email); type Keys = keyof typeof response; const keys = ['Email', 'Name', 'Tags'] as Keys[]; return { content: [ { type: "text", text: keys.map(x => `- ${x}: '${response[x]}'`).join("\n") } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } },
- src/tools/api.ts:77-80 (schema)Zod schema for input parameters: listId (UUID) and email.parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list"), email: z.string().email().describe("Email of the subscriber") }),
- src/tools/api.ts:74-104 (registration)Tool registration via server.addTool, defining name, description, schema, annotations, and handler.server.addTool({ name: "get_subscriber_by_email", description: "Get subscriber by email", parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list"), email: z.string().email().describe("Email of the subscriber") }), annotations: { title: "Get subscriber by email", openWorldHint: true, }, execute: async ({ listId, email }) => { try { const response = await client.subscribers.findByEmail(listId, email); type Keys = keyof typeof response; const keys = ['Email', 'Name', 'Tags'] as Keys[]; return { content: [ { type: "text", text: keys.map(x => `- ${x}: '${response[x]}'`).join("\n") } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } }, });