Skip to main content
Glama

removeContactFromList

Remove a specific contact from a contact list by providing the contact's email and the list name.

Instructions

Remove a particular contact from the contact list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes
listNameYes

Implementation Reference

  • src/server.ts:339-371 (registration)
    Registration of the 'removeContactFromList' tool via server.tool(), with Zod schema for email and listName, and handler that calls the API function.
    server.tool(
      "removeContactFromList",
      "Remove a particular contact from the contact list",
      {
          email: z.string(),
          listName: z.string(),
          
      },
      async (params) => {
        try {
          const respone = await removeContactFromList(mmApiKey, params.email, params.listName);
          
          // 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 reomved '${params.email} from the 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 delete",
            }],
            isError: true
          };
        }
      }
    );
  • Type definition for RemoveContactFromListResponse with a message field.
    export interface RemoveContactFromListResponse {
      message: string;
    }
  • Core handler function removeContactFromList that makes an axios POST request to the Mailmodo API endpoint to remove a contact from a list by email and listName.
    export const removeContactFromList = async (
        mmApiKey: string,
        email: string,
        listName: string
      ): Promise<RemoveContactFromListResponse> => {
        try {
          const response = await axios.post<RemoveContactFromListResponse>(
            'https://api.mailmodo.com/api/v1/removeFromList',
            {
              email,
              listName
            },
            {
              headers: {
                'Accept': 'application/json',
                'mmApiKey': mmApiKey || ''
              }
            }
          );
          return response.data;
        } catch (error) {
          if (error instanceof AxiosError) {
            if(error.status === 400){
                return {message: "This contact doesn't exists in list"};
            }
            throw error;
          }
          throw new Error('Failed to remove contact from list');
        }
      };
  • Import of removeContactFromList from contactManagement module into server.ts.
    import { addContactToList, bulkAddContactToList, deleteContact, getAllContactLists, getContactDetails, removeContactFromList, resubscribeContact, unsubscribeContact } from "./apicalls/contactManagement";
  • Import of RemoveContactFromListResponse type from types/addContactsTypes.
    import { AddBatchContactToListResponse, AddContactToListResponse, BulkMailmodoContact, MailmodoContact, GetContactListsResponse, RemoveContactFromListResponse } from "types/addContactsTypes";
Behavior2/5

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

The description merely states 'remove', implying mutation, but with no annotations provided, it fails to disclose details such as side effects, irreversibility, or error handling (e.g., contact not found).

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, concise sentence with no extraneous information. However, it could be expanded slightly to cover parameters without losing conciseness.

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

Completeness3/5

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

For a simple removal tool with two required parameters and no output schema, the description provides the core purpose but omits details like expected parameter formats or return behavior. Adequate but not thorough.

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

Parameters2/5

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

With 0% schema description coverage, the description must add meaning. It implicitly maps 'contact' to the email parameter and 'contact list' to listName, but does not explicitly link to the schema fields, reducing clarity.

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 states the action ('Remove') and the resource ('a particular contact from the contact list'), clearly distinguishing from sibling add tools. However, it does not explicitly reference the 'listName' parameter, leaving room for ambiguity about which list.

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 guidance is provided on when to use this tool versus alternatives (e.g., addContactToList, unsubscribeContact). The context of sibling tools is not leveraged to clarify appropriate use cases.

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