Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_statistics_by_date

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

Instructions

Fetch campaign statistics for a specific date range.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch statistics 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 isCampaignStatisticsByDateParams, makes an authenticated API call to Smartlead's /campaigns/{campaign_id}/analytics-by-date endpoint with start_date and end_date query parameters, and returns the JSON response or formatted error.
    async function handleCampaignStatisticsByDate( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isCampaignStatisticsByDateParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_campaign_statistics_by_date' ); } const { campaign_id, start_date, end_date } = args; try { const response = await withRetry( async () => apiClient.get(`/campaigns/${campaign_id}/analytics-by-date`, { params: { start_date, end_date } }), 'get campaign statistics 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 metadata including name, description, category, and input schema with required parameters: campaign_id (number), start_date (string YYYY-MM-DD), end_date (string YYYY-MM-DD).
    export const CAMPAIGN_STATISTICS_BY_DATE_TOOL: CategoryTool = { name: 'smartlead_get_campaign_statistics_by_date', description: 'Fetch campaign statistics for a specific date range.', category: ToolCategory.CAMPAIGN_STATISTICS, inputSchema: { type: 'object', properties: { campaign_id: { type: 'number', description: 'ID of the campaign to fetch statistics for', }, start_date: { type: 'string', description: 'Start date in YYYY-MM-DD format', }, end_date: { type: 'string', description: 'End date in YYYY-MM-DD format', }, }, required: ['campaign_id', 'start_date', 'end_date'], }, };
  • src/index.ts:212-214 (registration)
    Bulk registers all statistics tools (including smartlead_get_campaign_statistics_by_date via statisticsTools array) to the ToolRegistry if the campaignStatistics feature category is enabled.
    if (enabledCategories.campaignStatistics) { toolRegistry.registerMany(statisticsTools); }
  • Dispatches tool calls matching the name to the specific handler function handleCampaignStatisticsByDate within the statistics tool handler.
    case 'smartlead_get_campaign_statistics_by_date': { return handleCampaignStatisticsByDate(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