unsubscribe_subscriber
Remove a subscriber from a mailing list by specifying the list ID and subscriber email using the MCP server for Sitecore Send.
Instructions
Unsubscribe subscriber from a mailing list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes | Email of the subscriber | ||
| listId | Yes | Id of the mailing list |
Implementation Reference
- src/tools/api.ts:149-165 (handler)The handler function that executes the unsubscribe_subscriber tool by calling the SendClient API to unsubscribe the subscriber from the specified mailing list, with error handling.execute: async ({ listId, email }) => { try { await client.subscribers.unsubscribe(listId, email); return { content: [ { type: "text", text: `Subscriber '${email}' successfully unsubscribed from mailing list '${listId}'` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } }
- src/tools/api.ts:141-144 (schema)Zod schema defining the input parameters: listId (UUID) and email for the unsubscribe_subscriber tool.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:138-166 (registration)Registration of the unsubscribe_subscriber tool using server.addTool, including name, description, schema, annotations, and handler.server.addTool({ name: "unsubscribe_subscriber", description: "Unsubscribe subscriber from a mailing list", parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list"), email: z.string().email().describe("Email of the subscriber") }), annotations: { title: "Unsubscribe subscriber from a mailing list", openWorldHint: true, }, execute: async ({ listId, email }) => { try { await client.subscribers.unsubscribe(listId, email); return { content: [ { type: "text", text: `Subscriber '${email}' successfully unsubscribed from mailing list '${listId}'` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } } });