Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_lead_statistics

Retrieve detailed lead statistics for email marketing campaigns, including engagement metrics and filtering options for campaign analysis.

Instructions

Fetch lead statistics for a campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch lead statistics for
created_at_gtNoFilter by leads created after this date (YYYY-MM-DD format)
event_time_gtNoFilter by events after this date (YYYY-MM-DD format)
limitNoMaximum number of leads to return (max 100)
offsetNoOffset for pagination

Implementation Reference

  • Core execution logic: validates parameters, queries Smartlead API `/campaigns/{campaign_id}/lead-statistics`, returns JSON data or error response.
    async function handleCampaignLeadStatistics( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isCampaignLeadStatisticsParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_get_campaign_lead_statistics' ); } const { campaign_id, ...queryParams } = args; try { const response = await withRetry( async () => apiClient.get(`/campaigns/${campaign_id}/lead-statistics`, { params: queryParams }), 'get campaign lead statistics' ); 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, }; } }
  • Tool metadata and input schema definition specifying parameters for campaign lead statistics query.
    export const CAMPAIGN_LEAD_STATISTICS_TOOL: CategoryTool = { name: 'smartlead_get_campaign_lead_statistics', description: 'Fetch lead statistics for a campaign.', category: ToolCategory.CAMPAIGN_STATISTICS, inputSchema: { type: 'object', properties: { campaign_id: { type: 'number', description: 'ID of the campaign to fetch lead statistics for', }, limit: { type: 'number', description: 'Maximum number of leads to return (max 100)', }, created_at_gt: { type: 'string', description: 'Filter by leads created after this date (YYYY-MM-DD format)', }, event_time_gt: { type: 'string', description: 'Filter by events after this date (YYYY-MM-DD format)', }, offset: { type: 'number', description: 'Offset for pagination', }, }, required: ['campaign_id'], }, };
  • src/index.ts:212-214 (registration)
    Conditional registration of all statistics tools (including this one) into the tool registry.
    if (enabledCategories.campaignStatistics) { toolRegistry.registerMany(statisticsTools); }
  • Dispatch from main statistics handler to specific lead statistics handler.
    case 'smartlead_get_campaign_lead_statistics': { return handleCampaignLeadStatistics(args, apiClient, withRetry); }
  • src/index.ts:213-213 (registration)
    Specific registration call for statistics tools array.
    toolRegistry.registerMany(statisticsTools);

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