Skip to main content
Glama

broadcastCampaignToList

Send targeted email campaigns to specific contact lists with a single API request. Personalize content and ensure safe retries using unique keys for efficiency.

Instructions

The broadcast campaign API allows the user to trigger campaigns to the entire contact list using a single API request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaignIdYesCampaign id of the campaign to be triggered
campaign_dataNoOptional set of personalization parameters for the campaign. Each key represents a variable (e.g., "first_name") to be used in the email template. If a key is missing, the backend will fetch values from contact properties or default to an empty string.
idempotencyKeyNoOptional unique key to allow retries of the same campaign within 24 hours. Allows safe resending. For example: "2024-09-05T17:00:00Z".
listIdYesId of the contact list or segment for which the campaign should be triggered.
subjectNoOptional subject line of the campaign. This will appear as the subject of the email sent to recipients.

Implementation Reference

  • The handler function for the 'broadcastCampaignToList' tool. It receives parameters, calls bulkTriggerMailmodoCampaign to perform the broadcast, and formats the response as MCP content.
    async (params) => {
      try {
        const { campaignId, ...newparams } = params;
        const respone = await bulkTriggerMailmodoCampaign(mmApiKey, params.campaignId, newparams);
        
        // Here you would typically integrate with your event sending system
        // For example: eventBus.emit(eventName, eventData)
        
        // For demonstration, we'll just return a success message
        return {
          content: [{
            type: "text",
            text: respone.message ?`Successfully sent email to '${params.listId} for the campaignId ${params.campaignId} with message ${respone.message}.`: `Something went wrong. Please check if the email is correct`,
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: error instanceof Error ? error.message : "Failed to delete",
          }],
          isError: true
        };
      }
    }
  • Input schema validation using Zod for the 'broadcastCampaignToList' tool parameters.
    {
      campaignId: z.string().describe('Campaign id of the campaign to be triggered'),
      listId: z
        .string({
          required_error: 'listId is required',
          invalid_type_error: 'listId must be a string',
        })
        .describe('Id of the contact list or segment for which the campaign should be triggered.'),
    
      subject: z
        .string()
        .optional()
        .describe('Optional subject line of the campaign. This will appear as the subject of the email sent to recipients.'),
    
      idempotencyKey: z
        .string()
        .optional()
        .describe('Optional unique key to allow retries of the same campaign within 24 hours. Allows safe resending. For example: "2024-09-05T17:00:00Z".'),
    
      campaign_data: z
        .record(z.string())
        .optional()
        .describe('Optional set of personalization parameters for the campaign. Each key represents a variable (e.g., "first_name") to be used in the email template. If a key is missing, the backend will fetch values from contact properties or default to an empty string.'),
    },
  • src/server.ts:440-492 (registration)
    Registration of the 'broadcastCampaignToList' MCP tool on the server, specifying name, description, input schema, and handler.
    server.tool(
      "broadcastCampaignToList",
      "The broadcast campaign API allows the user to trigger campaigns to the entire contact list using a single API request.",
      {
        campaignId: z.string().describe('Campaign id of the campaign to be triggered'),
        listId: z
          .string({
            required_error: 'listId is required',
            invalid_type_error: 'listId must be a string',
          })
          .describe('Id of the contact list or segment for which the campaign should be triggered.'),
      
        subject: z
          .string()
          .optional()
          .describe('Optional subject line of the campaign. This will appear as the subject of the email sent to recipients.'),
      
        idempotencyKey: z
          .string()
          .optional()
          .describe('Optional unique key to allow retries of the same campaign within 24 hours. Allows safe resending. For example: "2024-09-05T17:00:00Z".'),
      
        campaign_data: z
          .record(z.string())
          .optional()
          .describe('Optional set of personalization parameters for the campaign. Each key represents a variable (e.g., "first_name") to be used in the email template. If a key is missing, the backend will fetch values from contact properties or default to an empty string.'),
      },
      async (params) => {
        try {
          const { campaignId, ...newparams } = params;
          const respone = await bulkTriggerMailmodoCampaign(mmApiKey, params.campaignId, newparams);
          
          // Here you would typically integrate with your event sending system
          // For example: eventBus.emit(eventName, eventData)
          
          // For demonstration, we'll just return a success message
          return {
            content: [{
              type: "text",
              text: respone.message ?`Successfully sent email to '${params.listId} for the campaignId ${params.campaignId} with message ${respone.message}.`: `Something went wrong. Please check if the email is correct`,
            }]
          };
        } catch (error) {
          return {
            content: [{
              type: "text",
              text: error instanceof Error ? error.message : "Failed to delete",
            }],
            isError: true
          };
        }
      }
    );
  • TypeScript interface defining the structure for bulk trigger campaign request, used likely by the tool's helper function.
    export interface BulkTriggerCampaignRequest {
      listId: string;
      subject?: string;
      idempotencyKey?: string;
      campaign_data?: Record<string, string>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions 'trigger campaigns' which implies a write operation, but lacks details on permissions, rate limits, side effects (e.g., email sends), or response behavior. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that states the core functionality without unnecessary details. It's appropriately sized and front-loaded, though it could be slightly more structured with usage context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 5 parameters, no annotations, and no output schema, the description is incomplete. It lacks behavioral context, error handling, and output details, making it insufficient for an agent to fully understand the tool's operation and implications.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing detailed parameter documentation. The description adds no parameter-specific information beyond what's in the schema, so it meets the baseline of 3 without compensating or adding extra value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'trigger campaigns to the entire contact list using a single API request.' It specifies the verb ('trigger') and resource ('campaigns'), but doesn't explicitly differentiate from sibling tools like 'sendEmailToCampaign' or 'MailmodoCampainReportTool', which appear related to campaigns.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It mentions 'entire contact list' but doesn't clarify if this is for bulk operations or how it differs from other campaign-related tools in the sibling list, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/mailmodo/mailmodo-mcp'

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