Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_top_level_analytics

Retrieve high-level performance metrics for email campaigns to monitor key statistics and track marketing effectiveness.

Instructions

Fetch top level analytics for a campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch analytics for

Implementation Reference

  • Executes the tool logic: validates parameters using isCampaignTopLevelAnalyticsParams, calls Smartlead API endpoint `/campaigns/${campaign_id}/analytics`, returns JSON response or formatted error.
    async function handleCampaignTopLevelAnalytics(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isCampaignTopLevelAnalyticsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_top_level_analytics'
        );
      }
    
      const { campaign_id } = args;
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${campaign_id}/analytics`),
          'get campaign top level 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,
        };
      }
    }
  • MCP tool definition including name, description, category, and JSON schema for input validation (requires campaign_id).
    export const CAMPAIGN_TOP_LEVEL_ANALYTICS_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_top_level_analytics',
      description: 'Fetch top level analytics for a campaign.',
      category: ToolCategory.CAMPAIGN_STATISTICS,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch analytics for',
          },
        },
        required: ['campaign_id'],
      },
    };
  • src/index.ts:212-214 (registration)
    Registers the array of statistics tools (including this one) via toolRegistry.registerMany(statisticsTools) when campaignStatistics feature is enabled.
    if (enabledCategories.campaignStatistics) {
      toolRegistry.registerMany(statisticsTools);
    }
  • TypeScript type guard for runtime input validation, ensuring args is an object with numeric campaign_id.
    export function isCampaignTopLevelAnalyticsParams(args: unknown): args is CampaignTopLevelAnalyticsParams {
      if (typeof args !== 'object' || args === null) {
        return false;
      }
    
      const params = args as CampaignTopLevelAnalyticsParams;
      
      return typeof params.campaign_id === 'number';
    }
  • The statisticsTools export array that includes this tool's CategoryTool definition for bulk registration.
    export const statisticsTools: CategoryTool[] = [
      CAMPAIGN_STATISTICS_TOOL,
      CAMPAIGN_STATISTICS_BY_DATE_TOOL,
      WARMUP_STATS_BY_EMAIL_TOOL,
      CAMPAIGN_TOP_LEVEL_ANALYTICS_TOOL,
      CAMPAIGN_TOP_LEVEL_ANALYTICS_BY_DATE_TOOL,
      CAMPAIGN_LEAD_STATISTICS_TOOL,
      CAMPAIGN_MAILBOX_STATISTICS_TOOL,
      DOWNLOAD_CAMPAIGN_DATA_TOOL,
      VIEW_DOWNLOAD_STATISTICS_TOOL,
    ]; 
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool fetches analytics, implying a read-only operation, but fails to specify whether it requires authentication, has rate limits, returns paginated data, or details the response format. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it highly concise and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (analytics fetching with no output schema) and lack of annotations, the description is incomplete. It does not explain what 'top level analytics' includes, how results are structured, or any behavioral traits like error handling. For a tool with potential nuanced outputs, this minimal description fails to provide sufficient context for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the 'campaign_id' parameter. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints. Since schema coverage is high, the baseline score of 3 is appropriate, as the schema adequately handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Fetch top level analytics for a campaign' clearly states the action ('fetch') and resource ('top level analytics for a campaign'), but it's vague about what 'top level analytics' entails compared to siblings like 'smartlead_get_campaign_analytics_by_date' or 'smartlead_get_campaign_statistics'. It distinguishes the tool by name but lacks specificity in differentiating the analytics scope from similar tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'smartlead_get_campaign_analytics_by_date' or 'smartlead_get_campaign_statistics'. The description implies usage for fetching analytics but offers no context on prerequisites, exclusions, or comparative scenarios with sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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