Skip to main content
Glama
dazanza
by dazanza

batch_add_members

Add up to 500 subscribers to a Mailchimp audience in a single operation while preserving existing subscription statuses.

Instructions

Add multiple subscribers to a Mailchimp audience in one call. Handles up to 500 members per batch. Will not overwrite existing members' subscription status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesAudience/list ID
membersYesArray of contacts to add (max 500)
update_existingNoUpdate merge fields for existing members (default false)

Implementation Reference

  • The handler function for the batch_add_members tool, which processes the members array and calls mailchimp.lists.batchListMembers.
    async ({ list_id, members, update_existing }) => {
      const batch = members.map((m) => ({
        email_address: m.email,
        status_if_new: "subscribed",
        merge_fields: {
          ...(m.first_name ? { FNAME: m.first_name } : {}),
          ...(m.last_name ? { LNAME: m.last_name } : {}),
        },
      }));
      const result = await mailchimp.lists.batchListMembers(list_id, {
        members: batch,
        update_existing: update_existing || false,
      });
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                total_created: result.total_created,
                total_updated: result.total_updated,
                error_count: result.error_count,
                errors: result.errors.slice(0, 10).map((e) => ({ email: e.email_address, error: e.error })),
              },
              null,
              2
            ),
          },
        ],
  • server.js:386-401 (registration)
    Registration of the batch_add_members tool with its schema definition in server.js.
    server.tool(
      "batch_add_members",
      "Add multiple subscribers to a Mailchimp audience in one call. Handles up to 500 members per batch. Will not overwrite existing members' subscription status.",
      {
        list_id: z.string().describe("Audience/list ID"),
        members: z
          .array(
            z.object({
              email: z.string().describe("Email address"),
              first_name: z.string().optional().describe("First name"),
              last_name: z.string().optional().describe("Last name"),
            })
          )
          .describe("Array of contacts to add (max 500)"),
        update_existing: z.boolean().optional().describe("Update merge fields for existing members (default false)"),
      },

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/dazanza/mailchimp-mcp'

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