get_subscribers
Retrieve subscriber data from a Sitecore Send mailing list to manage contacts and analyze audience engagement.
Instructions
Get subscribers of a mailing list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | Id of the mailing list |
Implementation Reference
- src/tools/api.ts:63-71 (handler)Handler function that retrieves subscribers from a specified mailing list using SendClient, maps them to a formatted string list, and returns as text content.execute: async ({ listId }) => { const response = await client.subscribers.fromList(listId); const result = response.Subscribers.map(x => `- '${x.Email}', Name: '${x.Name}', Tags: [${x.Tags.join(", ")}]`); return { content: [ { type: "text", text: result.join("\n") } ] } },
- src/tools/api.ts:56-58 (schema)Zod schema defining the input parameter: listId as a UUID string.parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list") }),
- src/tools/api.ts:53-72 (registration)Registration of the 'get_subscribers' tool using server.addTool, including name, description, schema, annotations, and handler.server.addTool({ name: "get_subscribers", description: "Get subscribers of a mailing list", parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list") }), annotations: { title: "Get subscribers of a mailing list", openWorldHint: true, }, execute: async ({ listId }) => { const response = await client.subscribers.fromList(listId); const result = response.Subscribers.map(x => `- '${x.Email}', Name: '${x.Name}', Tags: [${x.Tags.join(", ")}]`); return { content: [ { type: "text", text: result.join("\n") } ] } }, });