Skip to main content
Glama

add_subscriber

Add a new subscriber to a Sitecore Send mailing list by providing their email address and list ID, enabling targeted email marketing campaigns.

Instructions

Add subscriber to a mailing list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesId of the mailing list
emailYesEmail of the subscriber
nameNoName of the subscriber
tagsNoTags of the subscriber

Implementation Reference

  • The execute handler function that adds a subscriber to the specified mailing list using the SendClient API, handling success and error responses.
    execute: async ({ listId, email, name, tags }) => { try { const response = await client.subscribers.add(listId, { Email: email, Name: name, Tags: tags }); return { content: [ { type: "text", text: `Subscriber '${response.Email}' successfully added to mailing list '${listId}'` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } }
  • Zod schema defining the input parameters for the add_subscriber tool: listId (UUID), email, optional name and tags.
    parameters: z.object({ listId: z.string().uuid().describe("Id of the mailing list"), email: z.string().email().describe("Email of the subscriber"), name: z.string().optional().describe("Name of the subscriber"), tags: z.array(z.string()).optional().describe("Tags of the subscriber") }),
  • Registration of the 'add_subscriber' tool using server.addTool, including name, description, schema, annotations, and execute handler.
    server.addTool({ name: "add_subscriber", description: "Add subscriber to 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"), name: z.string().optional().describe("Name of the subscriber"), tags: z.array(z.string()).optional().describe("Tags of the subscriber") }), annotations: { title: "Add subscriber to a mailing list", openWorldHint: true, }, execute: async ({ listId, email, name, tags }) => { try { const response = await client.subscribers.add(listId, { Email: email, Name: name, Tags: tags }); return { content: [ { type: "text", text: `Subscriber '${response.Email}' successfully added to mailing list '${listId}'` } ] } } catch (e) { return { content: [ { type: "text", text: `Error: ${(e as ApiResponseError).sendResponse?.Error}` } ] } } } });
  • src/tools/index.ts:7-9 (registration)
    High-level tool registration function that calls addApiTools, which includes registering the 'add_subscriber' tool.
    addSmptTools(server, config.smtp); addApiTools(server, config.api, config.transactionalEmails); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/izharikov/send-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server