Skip to main content
Glama

addContactToList

Add a contact to a Mailmodo list by providing email and list name, with optional fields for personal details such as name, birthday, phone, address, and more.

Instructions

Add Contact to list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
listNameYes
dataNo
created_atNo
last_clickNo
last_openNo
timezoneNo

Implementation Reference

  • The main handler function that makes the POST request to Mailmodo API (https://api.mailmodo.com/api/v1/addToList) with the contact payload and API key. Validates email and listName are present, then returns response data.
    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');
        }
    }
  • src/server.ts:153-195 (registration)
    The MCP server tool registration for 'addContactToList'. Defines input schema (email, listName, optional data/created_at/last_click/last_open/timezone), calls the handler, and formats the 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
          };
        }
      }
    );
  • The MailmodoContact interface defining the input shape for the addContactToList handler: email, listName, data (UserProperties), created_at, last_click, last_open, and timezone.
    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
    }
  • The AddContactToListResponse interface defining the API response shape with success boolean and optional message string.
    export interface AddContactToListResponse {
        // Define your expected response structure here
        success: boolean;
        message?: string;
    }
  • The contactPropertiesSchema Zod schema used for the optional 'data' field in the tool input. Supports standard contact fields (name, email, phone, address, etc.) with catchall for custom properties.
    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()])
    );
Behavior1/5

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

With no annotations and no description of side effects, permission requirements, or behavior when a contact already exists, the tool is completely opaque. The agent cannot infer mutation or idempotency.

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?

The description is extremely short, but at the cost of necessary information. It fails to be concise in a meaningful way; it is under-specified and does not earn its place.

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 no annotations, no output schema, and an incomplete parameter set, the description is wholly inadequate. It fails to explain return values, error conditions, or when the operation succeeds.

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 description adds no meaning to the parameters. Although the input schema has descriptions for nested data fields, the top-level parameters (email, listName, created_at, etc.) remain undocumented. With 0% schema description coverage and 7 parameters, the lack of param information is a critical gap.

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

Purpose1/5

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

The description 'Add Contact to list' is a tautology that merely restates the tool name without adding specificity or clarifying what kind of list or what scope. It offers no distinction from sibling tools like addBulkContactToList.

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?

No guidance is provided on when to use this tool versus alternatives such as addBulkContactToList or other contact management tools. The description omits any context about prerequisites, typical use cases, or exclusions.

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

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