Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_mailbox_statistics

Retrieve detailed mailbox performance metrics for email campaigns, including delivery rates and engagement data, to monitor campaign effectiveness and optimize email marketing strategies.

Instructions

Fetch mailbox statistics for a campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch mailbox statistics for
client_idNoClient ID if the campaign is client-specific
end_dateNoEnd date (must be used with start_date)
limitNoMaximum number of results to return (min 1, max 20)
offsetNoOffset for pagination
start_dateNoStart date (must be used with end_date)
timezoneNoTimezone for the data (e.g., "America/Los_Angeles")

Implementation Reference

  • Core handler function that validates input parameters using isCampaignMailboxStatisticsParams, extracts campaign_id and query parameters, makes authenticated API call to Smartlead's /campaigns/{campaign_id}/mailbox-statistics endpoint with retry logic, and returns formatted JSON response or error message.
    async function handleCampaignMailboxStatistics(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isCampaignMailboxStatisticsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_mailbox_statistics'
        );
      }
    
      const { campaign_id, ...queryParams } = args;
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${campaign_id}/mailbox-statistics`, {
            params: queryParams
          }),
          'get campaign mailbox 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 definition including name, description, category, and detailed inputSchema specifying parameters like campaign_id (required), client_id, offset, limit (1-20), start_date/end_date pair, and timezone.
    export const CAMPAIGN_MAILBOX_STATISTICS_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_mailbox_statistics',
      description: 'Fetch mailbox statistics for a campaign.',
      category: ToolCategory.CAMPAIGN_STATISTICS,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch mailbox statistics for',
          },
          client_id: {
            type: 'string',
            description: 'Client ID if the campaign is client-specific',
          },
          offset: {
            type: 'number',
            description: 'Offset for pagination',
          },
          limit: {
            type: 'number',
            description: 'Maximum number of results to return (min 1, max 20)',
          },
          start_date: {
            type: 'string',
            description: 'Start date (must be used with end_date)',
          },
          end_date: {
            type: 'string',
            description: 'End date (must be used with start_date)',
          },
          timezone: {
            type: 'string',
            description: 'Timezone for the data (e.g., "America/Los_Angeles")',
          },
        },
        required: ['campaign_id'],
      },
    };
  • src/index.ts:212-214 (registration)
    Registers the statisticsTools array (which includes this tool) to the toolRegistry if campaignStatistics category is enabled by license/configuration.
    if (enabledCategories.campaignStatistics) {
      toolRegistry.registerMany(statisticsTools);
    }
  • Category-level dispatcher function that routes 'smartlead_get_campaign_mailbox_statistics' calls to the specific handleCampaignMailboxStatistics handler.
    export async function handleStatisticsTool(
      toolName: string,
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      switch (toolName) {
        case 'smartlead_get_campaign_statistics': {
          return handleCampaignStatistics(args, apiClient, withRetry);
        }
        case 'smartlead_get_campaign_statistics_by_date': {
          return handleCampaignStatisticsByDate(args, apiClient, withRetry);
        }
        case 'smartlead_get_warmup_stats_by_email': {
          return handleWarmupStatsByEmail(args, apiClient, withRetry);
        }
        case 'smartlead_get_campaign_top_level_analytics': {
          return handleCampaignTopLevelAnalytics(args, apiClient, withRetry);
        }
        case 'smartlead_get_campaign_top_level_analytics_by_date': {
          return handleCampaignTopLevelAnalyticsByDate(args, apiClient, withRetry);
        }
        case 'smartlead_get_campaign_lead_statistics': {
          return handleCampaignLeadStatistics(args, apiClient, withRetry);
        }
        case 'smartlead_get_campaign_mailbox_statistics': {
          return handleCampaignMailboxStatistics(args, apiClient, withRetry);
        }
        case 'smartlead_download_campaign_data': {
          return handleDownloadCampaignData(args, apiClient, withRetry);
        }
        case 'smartlead_view_download_statistics': {
          return handleViewDownloadStatistics(args);
        }
        default:
          throw new Error(`Unknown statistics tool: ${toolName}`);
      }
    }
  • Includes the CAMPAIGN_MAILBOX_STATISTICS_TOOL in the statisticsTools export array used 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?

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Fetch' implies a read-only operation, the description doesn't mention authentication requirements, rate limits, pagination behavior (implied by offset/limit parameters but not explained), error conditions, or what format the statistics are returned in. This leaves significant gaps for an agent to understand how to use the tool effectively.

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, clear sentence with zero wasted words. It's front-loaded with the core purpose and doesn't include any unnecessary information. This is an excellent example of concise tool documentation.

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?

For a tool with 7 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'mailbox statistics' actually includes, how results are structured, or provide any context about the broader campaign system. The agent would need to guess about the tool's behavior and output format.

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?

Schema description coverage is 100%, so all parameters are documented in the input schema. The description doesn't add any additional semantic context about the parameters beyond what's already in the schema descriptions. This meets the baseline expectation when the schema does the heavy lifting, but doesn't provide extra value.

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

Purpose4/5

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

The description clearly states the action ('Fetch') and resource ('mailbox statistics for a campaign'), making the purpose understandable. However, it doesn't differentiate this tool from similar sibling tools like 'smartlead_get_campaign_statistics' or 'smartlead_get_mailbox_summary', which could cause confusion about which tool to use for specific mailbox-related statistics.

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?

The description provides no guidance on when to use this tool versus alternatives. With many sibling tools related to campaigns and statistics (e.g., 'smartlead_get_campaign_statistics', 'smartlead_get_campaign_lead_statistics'), there's no indication of what makes this tool unique or when it should be preferred over others.

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