Skip to main content
Glama

MailmodoCampainReportTool

Generate detailed campaign reports, including open, click, and submission counts, by providing campaign ID and date range for accurate performance analysis.

Instructions

Tool to get the campaign reports for a particular campaign like open, click submission count etc

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaignIdYes
fromDateYes
toDateYes

Implementation Reference

  • Handler function for MailmodoCampainReportTool that fetches the campaign report using the helper and returns the JSON data or an error message as text content.
    async ({ campaignId, fromDate, toDate }) => { const campaigns = await fetchCampaignReport(mmApiKey,campaignId,fromDate,toDate); return { content: [{ type: "text", text: campaigns.success? JSON.stringify(campaigns.data): "Something went wrong. Please check if correct campaign ID is being passed" }] } }
  • Input schema validation using Zod for campaignId (UUID string), fromDate and toDate (strings matching YYYY-MM-DD regex).
    { campaignId: z.string().uuid(), fromDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, { message: 'fromDate must be in YYYY-MM-DD format', }), toDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, { message: 'toDate must be in YYYY-MM-DD format', }), },
  • src/server.ts:78-97 (registration)
    Registration of the MailmodoCampainReportTool using McpServer.tool, including description, input schema, and inline handler function.
    server.tool("MailmodoCampainReportTool", "Tool to get the campaign reports for a particular campaign like open, click submission count etc", { campaignId: z.string().uuid(), fromDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, { message: 'fromDate must be in YYYY-MM-DD format', }), toDate: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, { message: 'toDate must be in YYYY-MM-DD format', }), }, async ({ campaignId, fromDate, toDate }) => { const campaigns = await fetchCampaignReport(mmApiKey,campaignId,fromDate,toDate); return { content: [{ type: "text", text: campaigns.success? JSON.stringify(campaigns.data): "Something went wrong. Please check if correct campaign ID is being passed" }] } } );
  • Supporting helper function that performs the actual API call to Mailmodo to retrieve campaign report data for the given campaign ID, date range, and API key.
    export async function fetchCampaignReport( mmApiKey: string, campaignId: string, fromDate: string, toDate: string ): Promise<CampaignReportResponse> { try { const response = await axios.post( `https://api.mailmodo.com/api/v1/campaignReports/${campaignId}`, { fromDate, toDate }, { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'mmApiKey': mmApiKey || '' } } ); return {success: true, data: response.data}; } catch (error) { console.error('Error fetching campaign report:', error); return {success: false, data: null}; } }

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