Skip to main content
Glama

archiveContact

Permanently archive contacts in Mailmodo by submitting their email address, ensuring streamlined contact management and data organization.

Instructions

permanently archive contact in mailmodo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailYes

Implementation Reference

  • src/server.ts:307-337 (registration)
    Registration of the 'archiveContact' MCP tool, including inline input schema (email: z.string()) and handler function that invokes the deleteContact helper and returns a text response.
    server.tool( "archiveContact", "permanently archive contact in mailmodo", { email: z.string() }, async (params) => { try { const respone = await deleteContact(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 deleted '${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 delete", }], isError: true }; } } );
  • Handler function for the 'archiveContact' tool, which calls the deleteContact API helper and formats the response.
    async (params) => { try { const respone = await deleteContact(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 deleted '${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 delete", }], isError: true }; } }
  • Input schema for the 'archiveContact' tool using Zod (requires email string).
    { email: z.string() },
  • The deleteContact helper function that makes the actual DELETE API call to Mailmodo's /contacts endpoint to archive the contact.
    export async function deleteContact( mmApiKey: string, email: string ): Promise<AddContactToListResponse> { if (!email) { throw new Error('Email is a required field'); } try { const response = await axios.delete<AddContactToListResponse>( 'https://api.mailmodo.com/api/v1/contacts', { headers: { 'Accept': 'application/json', 'mmApiKey': mmApiKey || '' }, data: { email } } ); return response.data; } catch (error) { if (error instanceof AxiosError) { if(error.status === 400){ return { success: true, message: "User Doesn't exist in system or already archived" }; } return { success: false, message: error.response?.data?.message || 'Failed to delete contact' }; } throw new Error('An unexpected error occurred'); } }

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