Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_top_level_analytics_by_date

Retrieve campaign analytics including key metrics for a specified date range to track performance and measure email marketing effectiveness.

Instructions

Fetch campaign top level 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

  • Core execution logic for the tool: validates input with isCampaignTopLevelAnalyticsByDateParams, calls Smartlead API /campaigns/{campaign_id}/top-level-analytics-by-date with date range params, returns JSON data or error.
    async function handleCampaignTopLevelAnalyticsByDate(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isCampaignTopLevelAnalyticsByDateParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_top_level_analytics_by_date'
        );
      }
    
      const { campaign_id, start_date, end_date } = args;
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${campaign_id}/top-level-analytics-by-date`, {
            params: {
              start_date,
              end_date
            }
          }),
          'get campaign top level 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,
        };
      }
    }
  • Tool definition including name, description, category (CAMPAIGN_STATISTICS), and input schema specifying required parameters: campaign_id (number), start_date/end_date (strings in YYYY-MM-DD).
    export const CAMPAIGN_TOP_LEVEL_ANALYTICS_BY_DATE_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_top_level_analytics_by_date',
      description: 'Fetch campaign top level analytics for a specific date range.',
      category: ToolCategory.CAMPAIGN_STATISTICS,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch analytics 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:211-214 (registration)
    Conditionally registers the statisticsTools array (containing this tool's definition) into the central ToolRegistry instance.
    // Register campaign statistics tools if enabled
    if (enabledCategories.campaignStatistics) {
      toolRegistry.registerMany(statisticsTools);
    }

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

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