Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_analytics_by_date

Retrieve campaign performance metrics for a specified date range to analyze email marketing effectiveness and track key engagement data.

Instructions

Fetch campaign analytics for a specific date range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch analytics for
end_dateYesEnd date in YYYY-MM-DD format
start_dateYesStart date in YYYY-MM-DD format

Implementation Reference

  • The core handler function that validates input parameters using isGetCampaignAnalyticsByDateParams, extracts campaign_id and date params, makes a GET request to the Smartlead API endpoint `/campaigns/${campaign_id}/analytics-by-date`, and returns the formatted response or error.
    async function handleGetCampaignAnalyticsByDate( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isGetCampaignAnalyticsByDateParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_campaign_analytics_by_date' ); } const { campaign_id, ...params } = args; try { const response = await withRetry( async () => apiClient.get(`/campaigns/${campaign_id}/analytics-by-date`, { params }), 'get campaign analytics by date' ); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], isError: false, }; } catch (error: any) { return { content: [{ type: 'text', text: `API Error: ${error.response?.data?.message || error.message}` }], isError: true, }; } }
  • Defines the tool's metadata including name, description, category (CAMPAIGN_MANAGEMENT), and detailed inputSchema with properties for campaign_id (number), start_date and end_date (date strings), marking all as required.
    export const GET_CAMPAIGN_ANALYTICS_BY_DATE_TOOL: CategoryTool = { name: 'smartlead_get_campaign_analytics_by_date', description: 'Fetch campaign analytics for a specific date range.', category: ToolCategory.CAMPAIGN_MANAGEMENT, inputSchema: { type: 'object', properties: { campaign_id: { type: 'number', description: 'ID of the campaign to fetch analytics for', }, start_date: { type: 'string', format: 'date', description: 'Start date in YYYY-MM-DD format', }, end_date: { type: 'string', format: 'date', description: 'End date in YYYY-MM-DD format', }, }, required: ['campaign_id', 'start_date', 'end_date'], }, };
  • src/index.ts:197-199 (registration)
    Registers the array of campaign tools (including this tool via campaignTools import) into the ToolRegistry if campaignManagement category is enabled in configuration. The registerTools() function is called at line 244.
    if (enabledCategories.campaignManagement) { toolRegistry.registerMany(campaignTools); }
  • src/index.ts:346-348 (registration)
    In the main CallToolRequestHandler (lines 270-392), routes tools in CAMPAIGN_MANAGEMENT category to the specific handleCampaignTool dispatcher based on tool name.
    case ToolCategory.CAMPAIGN_MANAGEMENT: return await handleCampaignTool(name, toolArgs, apiClient, withRetry); // case ToolCategory.EMAIL_ACCOUNT_MANAGEMENT:
  • The dispatcher switch case in handleCampaignTool that routes to the specific handler function for this tool name.
    case 'smartlead_get_campaign_analytics_by_date': { return handleGetCampaignAnalyticsByDate(args, apiClient, withRetry); }

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/jonathan-politzki/smartlead-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server