userDetails
Retrieve comprehensive contact details including profile information and engagement metrics by providing an email address. Access user-specific data stored in Mailmodo for analysis and targeted campaigns.
Instructions
Tool to get all details of a contact
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| Yes |
Implementation Reference
- src/server.ts:62-76 (registration)The tool 'userDetails' is registered as an MCP server tool on line 62. It accepts an 'email' string parameter, calls getContactDetails(), and returns the result as JSON text.
server.tool( "userDetails", "Tool to get all details of a contact ", { email: z.string(), }, async ({ email }) => { const details = await getContactDetails(mmApiKey,email); return{ content: [{ type: "text", text: JSON.stringify(details) }] }} ); - The getContactDetails() function is the actual handler/API call for the userDetails tool. It makes an HTTP GET request to the Mailmodo API's getContactDetails endpoint using the provided email, and returns the contact details.
export async function getContactDetails( mmApiKey: string, email: string ): Promise<any | null> { if (!email) { throw new Error('Email is a required field'); } try { const response = await axios.get<any>( `https://api.mailmodo.com/api/v1/getContactDetails?email=${encodeURIComponent(email)}`, { headers: { 'Accept': 'application/json', 'mmApiKey': mmApiKey || '' } } ); return response.data; } catch (error) { if (error instanceof AxiosError) { return null; } throw new Error('An unexpected error occurred'); } } - src/types/addContactsTypes.ts:31-47 (schema)Type interfaces (MailmodoContact and MailmodoContactWithoutList) that define the contact data structure used across contact management APIs.
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 } export interface MailmodoContactWithoutList { email: 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 }