Skip to main content
Glama

sendEmailToCampaign

Send personalized emails for campaigns using Mailmodo by specifying campaign ID, recipient email, and optional overrides like subject, sender name, or reply-to address.

Instructions

Trigger and email for email campaign trigger with personalization parameter added to the email template.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addToListNoOptional: List ID to which the contact should be added as part of triggering the campaign.
campaignIdYesCamapign id of the campaign to be triggered
campaign_dataNoOptional: Transient personalization parameters, not stored in the contact profile.
dataNoOptional: Personalization parameters saved to the contact's profile.
emailYesEmail address of the contact to whom you want to send the email. This is required.
fromNameNoOptional: Overrides the sender name for the campaign.
replyToNoOptional: Overrides the default reply-to email address for the campaign.
subjectNoOptional: Overrides the default subject line provided when creating the campaign.

Implementation Reference

  • The execution logic for the sendEmailToCampaign tool. It destructures parameters, calls the triggerMailmodoCampaign helper with API key and params, and returns success/error text content.
    async (params) => {
      try {
        const { campaignId, ...newparams } = params;
        const respone = await triggerMailmodoCampaign(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.email} 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
        };
      }
    }
  • Zod schema defining the input parameters for the sendEmailToCampaign tool, including required campaignId and email, and various optional personalization and override fields.
    {
      campaignId: z.string().describe('Camapign id of the campaign to be triggered'),
      email: z
        .string()
        .email({ message: "Invalid email address" })
        .describe("Email address of the contact to whom you want to send the email. This is required."),
    
      subject: z
        .string()
        .optional()
        .describe("Optional: Overrides the default subject line provided when creating the campaign."),
    
      replyTo: z
        .string()
        .optional()
        .describe("Optional: Overrides the default reply-to email address for the campaign."),
    
      fromName: z
        .string()
        .optional()
        .describe("Optional: Overrides the sender name for the campaign."),
    
      campaign_data: z
        .record(z.string())
        .optional()
        .describe("Optional: Transient personalization parameters, not stored in the contact profile."),
    
      data: z
        .record(z.string())
        .optional()
        .describe("Optional: Personalization parameters saved to the contact's profile."),
    
      addToList: z
        .string()
        .optional()
        .describe("Optional: List ID to which the contact should be added as part of triggering the campaign."),
    },
  • src/server.ts:373-438 (registration)
    Registration of the 'sendEmailToCampaign' MCP tool on the McpServer instance, including name, description, input schema, and handler function.
    server.tool(
      "sendEmailToCampaign",
      "Trigger and email for email campaign trigger with personalization parameter added to the email template. ",
      {
        campaignId: z.string().describe('Camapign id of the campaign to be triggered'),
        email: z
          .string()
          .email({ message: "Invalid email address" })
          .describe("Email address of the contact to whom you want to send the email. This is required."),
      
        subject: z
          .string()
          .optional()
          .describe("Optional: Overrides the default subject line provided when creating the campaign."),
      
        replyTo: z
          .string()
          .optional()
          .describe("Optional: Overrides the default reply-to email address for the campaign."),
      
        fromName: z
          .string()
          .optional()
          .describe("Optional: Overrides the sender name for the campaign."),
      
        campaign_data: z
          .record(z.string())
          .optional()
          .describe("Optional: Transient personalization parameters, not stored in the contact profile."),
      
        data: z
          .record(z.string())
          .optional()
          .describe("Optional: Personalization parameters saved to the contact's profile."),
      
        addToList: z
          .string()
          .optional()
          .describe("Optional: List ID to which the contact should be added as part of triggering the campaign."),
      },
      async (params) => {
        try {
          const { campaignId, ...newparams } = params;
          const respone = await triggerMailmodoCampaign(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.email} 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 type definition for TriggerCampaignRequest, matching the tool's input parameters (excluding campaignId), used by the triggerMailmodoCampaign helper.
    export interface TriggerCampaignRequest {
      email: string;
      subject?: string;
      replyTo?: string;
      fromName?: string;
      campaign_data?: Record<string, string>;
      data?: Record<string, string>;
      addToList?: string;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'triggering' and 'personalization,' implying a write operation that sends emails, but fails to detail critical aspects like rate limits, error handling, whether the email is sent immediately or queued, or what happens if parameters are invalid. This leaves significant gaps for a tool that performs an external action.

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

Conciseness3/5

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

The description is a single sentence that is front-loaded but somewhat awkwardly phrased ('email for email campaign trigger'). It avoids unnecessary fluff, but the redundancy and lack of clarity reduce its effectiveness, making it adequate but not exemplary in structure.

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?

Given the complexity of an 8-parameter tool with no annotations and no output schema, the description is insufficient. It doesn't explain the return values, error conditions, or behavioral nuances like the impact of personalization parameters. For a tool that triggers external communications, more context is needed to ensure proper usage.

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?

The schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds minimal value beyond the schema by mentioning 'personalization parameter,' which loosely relates to 'data' and 'campaign_data' parameters but doesn't provide additional syntax, format, or usage details. This meets the baseline for high schema coverage.

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

Purpose3/5

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

The description states the tool 'Trigger[s] an email for email campaign trigger with personalization parameter added to the email template,' which identifies the action (triggering) and resource (email campaign). However, it's somewhat vague and redundant ('email campaign trigger'), and it doesn't clearly differentiate from sibling tools like 'broadcastCampaignToList' or 'sendEvent' in terms of scope or use case.

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 doesn't mention prerequisites, such as needing a pre-configured campaign, or compare it to sibling tools like 'broadcastCampaignToList' for bulk operations or 'sendEvent' for other triggers, leaving the agent without context for selection.

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