Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_sequence_analytics

Fetch analytics data for email campaign sequences to track performance metrics and engagement over specific time periods.

Instructions

Fetch analytics data for a specific email campaign sequence.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch sequence analytics for
end_dateYesEnd date in YYYY-MM-DD HH:MM:SS format
start_dateYesStart date in YYYY-MM-DD HH:MM:SS format
time_zoneNoTimezone for the analytics data (e.g., "Europe/London")

Implementation Reference

  • The core handler function that validates the input parameters using isGetCampaignSequenceAnalyticsParams, makes an authenticated GET request to the Smartlead API endpoint `/campaigns/{campaign_id}/sequence-analytics` with date range and timezone parameters, formats the response as JSON text, and handles errors appropriately.
    async function handleGetCampaignSequenceAnalytics(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetCampaignSequenceAnalyticsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_sequence_analytics'
        );
      }
    
      const { campaign_id, ...params } = args;
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${campaign_id}/sequence-analytics`, { 
            params 
          }),
          'get campaign sequence analytics'
        );
    
        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 detailed input schema (JSON Schema) for validation, specifying required campaign_id, start_date, end_date, and optional time_zone.
    export const GET_CAMPAIGN_SEQUENCE_ANALYTICS_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_sequence_analytics',
      description: 'Fetch analytics data for a specific email campaign sequence.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch sequence analytics for',
          },
          start_date: {
            type: 'string',
            description: 'Start date in YYYY-MM-DD HH:MM:SS format',
          },
          end_date: {
            type: 'string',
            description: 'End date in YYYY-MM-DD HH:MM:SS format',
          },
          time_zone: {
            type: 'string',
            description: 'Timezone for the analytics data (e.g., "Europe/London")',
          },
        },
        required: ['campaign_id', 'start_date', 'end_date'],
      },
    };
  • Runtime type guard function that validates input arguments match the GetCampaignSequenceAnalyticsParams interface, checking for required properties with correct types.
    export function isGetCampaignSequenceAnalyticsParams(args: unknown): args is GetCampaignSequenceAnalyticsParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'campaign_id' in args &&
        typeof (args as { campaign_id: unknown }).campaign_id === 'number' &&
        'start_date' in args &&
        typeof (args as { start_date: unknown }).start_date === 'string' &&
        'end_date' in args &&
        typeof (args as { end_date: unknown }).end_date === 'string'
      );
    }
  • src/index.ts:197-199 (registration)
    Registers the array of campaign tools (including smartlead_get_campaign_sequence_analytics) to the tool registry if the campaignManagement category is enabled by license/features.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • Switch case in handleCampaignTool that dispatches execution to the specific handler function for this tool name.
    case 'smartlead_get_campaign_sequence_analytics': {
      return handleGetCampaignSequenceAnalytics(args, apiClient, withRetry);
    }

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