Skip to main content
Glama

unsubscribeContact

Remove a contact from Mailmodo by unsubscribing or suppressing their email address to stop future communications.

Instructions

Unsubscribe or supress contact in mailmodo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes

Implementation Reference

  • Core handler function that calls the Mailmodo API (POST /api/v1/contacts/unsubscribe) to unsubscribe a contact by email. Validates email input, sends the request with mmApiKey header, and returns success/failure response.
    export async function unsubscribeContact(
        mmApiKey: string,
        email: string
    ): Promise<AddContactToListResponse> {
        if (!email) {
            throw new Error('Email is a required field');
        }
    
        try {
            const response = await axios.post<AddContactToListResponse>(
                'https://api.mailmodo.com/api/v1/contacts/unsubscribe',
                {
                    email,
                },
                {
                    headers: {
                        'Accept': 'application/json',
                        'Content-Type': 'application/json',
                        'mmApiKey': mmApiKey || ''
                    }
                }
            );
    
            return response.data;
        } catch (error) {
            if (error instanceof AxiosError) {
                return {
                    success: false,
                    message: error.response?.data?.message || 'Failed to unsubscribe contact'
                };
            }
            throw new Error('An unexpected error occurred');
        }
    }
  • src/server.ts:243-273 (registration)
    Registers the 'unsubscribeContact' MCP tool on the server with a Zod schema requiring email (string). The handler delegates to the unsubscribeContact API function and formats the response.
    server.tool(
      "unsubscribeContact",
      "Unsubscribe or supress contact in mailmodo",
      {
          email: z.string()
      },
      async (params) => {
        try {
          const respone = await unsubscribeContact(mmApiKey,params.email);
          
          // 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 unsubscribed '${params.email} 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 unsubscribe",
            }],
            isError: true
          };
        }
      }
    );
  • Response type interface used by the unsubscribeContact function, containing success flag and optional message.
    export interface AddContactToListResponse {
        // Define your expected response structure here
        success: boolean;
        message?: string;
    }
  • Import statement that brings the unsubscribeContact function into the server module.
    import { addContactToList, bulkAddContactToList, deleteContact, getAllContactLists, getContactDetails, removeContactFromList, resubscribeContact, unsubscribeContact } from "./apicalls/contactManagement";
Behavior2/5

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

Without annotations, the description must carry behavioral disclosure. It only indicates a mutation (unsubscribe/suppress) but omits details like consequences, reversibility, or required permissions. This is insufficient for an agent to understand the tool's full impact.

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, which is concise, but it sacrifices necessary detail. It earns its place as a minimal statement but does not fully leverage the space.

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 tool's simplicity (one param, no output schema), the description should at least explain the outcome of unsubscribing. It fails to provide enough context to distinguish from sibling tools or to set correct expectations.

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 sole parameter 'email' is described only by its type in the schema (0% schema description coverage). The description adds no explanation about format, validation, or role, forcing the agent to infer its meaning.

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 clearly states the action (unsubscribe or suppress) and the resource (contact in Mailmodo). The misspelling 'supress' is minor, but the purpose is unambiguous and distinguishes it from siblings like resubscribeContact.

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 related siblings (e.g., archiveContact, removeContactFromList). The agent receives no context for decision-making among similar operations.

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