get_subscribers
Retrieve all subscribers associated with a specific mailing list in Sitecore Send by providing the list ID.
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)The main handler function that implements the logic for retrieving and formatting subscribers from a mailing list using the SendClient library.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 for the tool's input parameters, defining listId as a required UUID string.parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list") }),
- src/tools/api.ts:53-72 (registration)The server.addTool call that registers the get_subscribers tool with 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") } ] } }, });