Skip to main content
Glama

addBulkContactToList

Add multiple contacts to a Mailmodo list in a single API call, including their email, name, phone, address, and other custom fields.

Instructions

Add Many Contact to a list in single API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listNameYes
valuesYes

Implementation Reference

  • src/server.ts:197-241 (registration)
    Tool registration for addBulkContactToList using server.tool(). Defines schema and handler callback.
    server.tool(
      "addBulkContactToList",
      "Add Many Contact to a list in single API",
      {
          listName: z.string(),
          values: z.array(z.object({
            email: 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 bulkAddContactToList(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.listId != '' ?`Successfully added '${params.values.length}' contacts 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
          };
        }
      }
    );
  • Handler function that calls bulkAddContactToList API and returns success/error response.
      async (params) => {
        try {
          const respone = await bulkAddContactToList(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.listId != '' ?`Successfully added '${params.values.length}' contacts 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
          };
        }
      }
    );
  • Core API function bulkAddContactToList that makes HTTP POST to Mailmodo /addToList/batch endpoint.
    export async function bulkAddContactToList(
        mmApiKey: string,
        payload: BulkMailmodoContact
    ): Promise<AddBatchContactToListResponse> {
        const allHaveEmails = payload.values.every(user => typeof user.email === 'string' && user.email.trim() !== '');
        if (!allHaveEmails || !payload.listName) {
            throw new Error('Email and listname are required fields');
        }
    
        try {
            const response = await axios.post<AddBatchContactToListResponse>(
                'https://api.mailmodo.com/api/v1/addToList/batch',
                {
                    ...payload,
                },
                {
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        'mmApiKey': mmApiKey || ''
                    }
                }
            );
    
            return response.data;
        } catch (error) {
            if (error instanceof AxiosError) {
                return {listId: ''}
            }
            throw new Error('An unexpected error occurred');
        }
    }
  • Input schema for addBulkContactToList: listName (string) and values (array of contacts with email, data, timestamps, timezone).
    {
        listName: z.string(),
        values: z.array(z.object({
          email: 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(),
        }))
    },
  • BulkMailmodoContact interface and AddBatchContactToListResponse interface used by the handler.
    export interface BulkMailmodoContact{
      listName: string;
      values: MailmodoContactWithoutList[]
    }
Behavior2/5

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

No annotations exist. Description only says 'Add Many Contact' with no details on behavior such as error handling, idempotency, response format, or prerequisites (e.g., list existence). Lacks essential context beyond the 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?

One sentence is concise but omits critical details. The description is not well-structured to aid agent understanding; it lacks any structured breakdown of behavior or parameters.

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 complex nested input schema, lack of annotations, and no output schema, the description fails to provide adequate context. It does not cover return values, error scenarios, or constraints, making it insufficient for correct tool selection and invocation.

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?

Schema description coverage is 0% for top-level parameters. Description adds no information about 'listName' or 'values'. The nested schema has field descriptions, but the tool description does not clarify parameter purpose or usage.

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?

Description states 'Add Many Contact to a list in single API', clearly indicating bulk addition. The name and brief description imply bulk operation, but does not explicitly differentiate from the sibling 'addContactToList' which likely handles single contacts.

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?

No usage guidelines provided. Does not specify when to use this tool versus alternatives like 'addContactToList'. Sibling names hint at single vs bulk, but no explicit guidance.

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