Skip to main content
Glama

addContactToList

Add or update a contact to a specified mailing list in the Mailmodo server, including detailed user information for personalized campaigns.

Instructions

Add Contact to list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
created_atNo
dataNo
emailYes
last_clickNo
last_openNo
listNameYes
timezoneNo

Implementation Reference

  • MCP tool registration, input schema, and handler function for 'addContactToList'. The handler calls the API helper, handles errors, and returns a text response.
    server.tool(
      "addContactToList",
      "Add Contact to list ",
      {
          email: z.string(),
          listName: z.string(),
          data: contactPropertiesSchema.optional(),
          created_at: datetimeSchema.optional(),
          last_click: datetimeSchema.optional(),
          last_open: datetimeSchema.optional(),
          timezone: z
            .string()
            .regex(
              timezoneRegex,
              { message: "Must be a valid region-format timezone string" }
            )
            .optional(),
      },
      async (params) => {
        try {
          const respone = await addContactToList(mmApiKey,params);
          
          // 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.success?`Successfully added contact '${params.email}' to list ${params.listName} 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 send event",
            }],
            isError: true
          };
        }
      }
    );
  • Helper function implementing the core logic: validates input, makes axios POST to Mailmodo API /addToList endpoint, returns typed response or error.
    export async function addContactToList(
        mmApiKey: string,
        payload: MailmodoContact
    ): Promise<AddContactToListResponse> {
    
        if (!payload.email || !payload.listName) {
            throw new Error('Email and listname are required fields');
        }
    
        try {
            const response = await axios.post<AddContactToListResponse>(
                'https://api.mailmodo.com/api/v1/addToList',
                {
                    ...payload,
                },
                {
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        'mmApiKey': mmApiKey || ''
                    }
                }
            );
    
            return response.data;
        } catch (error) {
            if (error instanceof AxiosError) {
                return {success: false}
            }
            throw new Error('An unexpected error occurred');
        }
    }
  • Zod schema for contact properties (data field) and TypeScript interface for the API response used in addContactToList.
    export const contactPropertiesSchema = z.object({
      first_name: z.string().describe("First name of the user").optional(),
      last_name: z.string().describe("Last name of the user").optional(),
      name: z.string().describe("Full name of the user").optional(),
      gender: z.string().describe("Gender of the user").optional(),
      age: z.number().int().describe("Age of the user in numbers").optional(),
      birthday: dateSchema.describe("Birthdate of the user (ISO format or UNIX timestamp)").optional(),
      phone: z.string().describe("Primary phone number of the user").optional(),
      address1: z.string().describe("Line 1 of the address of the user").optional(),
      address2: z.string().describe("Line 2 of the address of the user").optional(),
      city: z.string().describe("City/district/village of the user").optional(),
      state: z.string().describe("State, region or province of the user").optional(),
      country: z.string().describe("Country of the user").optional(),
      postal_code: z.string().describe("PIN/ZIP Code of the user").optional(),
      designation: z.string().describe("Designation of the user").optional(),
      company: z.string().describe("Company of the user").optional(),
      industry: z.string().describe("Industry of the user").optional(),
      description: z.string().describe("Description of the user").optional(),
      anniversary_date: dateSchema.describe("Anniversary date (ISO format or UNIX timestamp)").optional(),
    }).catchall(
      // Allow any additional key-value pairs of types: string, number, boolean, or undefined
      z.union([z.string(), z.number(), z.boolean(), z.undefined()])
    );
    export interface AddContactToListResponse {
        // Define your expected response structure here
        success: boolean;
        message?: string;
    }
  • TypeScript interface defining the payload structure for MailmodoContact used in the addContactToList API call.
    export interface MailmodoContact {
        email: string;
        listName: string;
        data?: UserProperties;
        created_at?: string;  // ISO 8601 or UNIX timestamp
        last_click?: string;  // ISO 8601 or UNIX timestamp
        last_open?: string;   // ISO 8601 or UNIX timestamp
        timezone?: string;   // Region format timezone
    }
Behavior1/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 but fails completely. It doesn't indicate whether this is a read or write operation, what permissions might be required, whether it's idempotent, what happens on duplicate contacts, or what the response looks like. For a tool that appears to create/modify data, this lack of transparency is critical.

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

Conciseness2/5

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

While technically concise with just three words, this represents under-specification rather than effective brevity. The description is too sparse to be helpful, failing to provide necessary context that would help an agent understand and use the tool correctly. Every word should earn its place, but here there aren't enough words to begin with.

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

Completeness1/5

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

Given the complexity (7 parameters including nested objects), complete lack of annotations, no output schema, and 0% schema description coverage, the description is completely inadequate. It provides no information about what the tool does beyond its name, no parameter guidance, no behavioral context, and no usage instructions for what appears to be a data modification tool.

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

Parameters1/5

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

The schema has 7 parameters with 0% description coverage in the schema itself, and the tool description provides absolutely no information about parameters. It doesn't mention required fields like 'email' and 'listName', doesn't explain the complex 'data' object structure, or provide any context about what parameters mean or how they should be used.

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

Purpose2/5

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

The description 'Add Contact to list' is essentially a tautology that restates the tool name with minimal additional information. It specifies the verb ('Add') and resource ('Contact to list'), but lacks specificity about what kind of contact or list, and doesn't distinguish it from sibling tools like 'addBulkContactToList' or 'removeContactFromList'.

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

Usage Guidelines1/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, appropriate contexts, or comparisons to sibling tools like 'addBulkContactToList' for bulk operations or 'archiveContact' for different contact management actions. This leaves the agent without usage direction.

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