Skip to main content
Glama

add_subscriber

Add subscribers to a specific mailing list by providing their email, name, and optional tags. Ensure accurate targeting with unique list IDs using Sitecore Send.

Instructions

Add subscriber to a mailing list

Input Schema

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

Implementation Reference

  • The execute handler for the add_subscriber tool. It uses SendClient to add the subscriber to the specified list and returns success or error message.
    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 parameters for the add_subscriber tool: listId (required uuid), email (required email), name (optional string), tags (optional array of strings).
    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") }),
  • Direct registration of the add_subscriber tool using FastMCP's server.addTool method within the addApiTools function.
    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:8-8 (registration)
    Call to addApiTools within addTools function, which registers the add_subscriber tool among others.
    addApiTools(server, config.api, config.transactionalEmails);
  • src/server.ts:15-15 (registration)
    Top-level call to addTools in the server setup, which ultimately registers the add_subscriber tool.
    addTools(server, config);

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