Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_analytics_by_date

Retrieve campaign performance metrics for a specified date range to analyze email marketing effectiveness and track key engagement data.

Instructions

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

  • The core handler function that validates input parameters using isGetCampaignAnalyticsByDateParams, extracts campaign_id and date params, makes a GET request to the Smartlead API endpoint `/campaigns/${campaign_id}/analytics-by-date`, and returns the formatted response or error.
    async function handleGetCampaignAnalyticsByDate(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetCampaignAnalyticsByDateParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_analytics_by_date'
        );
      }
    
      const { campaign_id, ...params } = args;
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${campaign_id}/analytics-by-date`, { 
            params 
          }),
          'get campaign 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,
        };
      }
    }
  • Defines the tool's metadata including name, description, category (CAMPAIGN_MANAGEMENT), and detailed inputSchema with properties for campaign_id (number), start_date and end_date (date strings), marking all as required.
    export const GET_CAMPAIGN_ANALYTICS_BY_DATE_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_analytics_by_date',
      description: 'Fetch campaign analytics for a specific date range.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch analytics for',
          },
          start_date: {
            type: 'string',
            format: 'date',
            description: 'Start date in YYYY-MM-DD format',
          },
          end_date: {
            type: 'string',
            format: 'date',
            description: 'End date in YYYY-MM-DD format',
          },
        },
        required: ['campaign_id', 'start_date', 'end_date'],
      },
    };
  • src/index.ts:197-199 (registration)
    Registers the array of campaign tools (including this tool via campaignTools import) into the ToolRegistry if campaignManagement category is enabled in configuration. The registerTools() function is called at line 244.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • src/index.ts:346-348 (registration)
    In the main CallToolRequestHandler (lines 270-392), routes tools in CAMPAIGN_MANAGEMENT category to the specific handleCampaignTool dispatcher based on tool name.
    case ToolCategory.CAMPAIGN_MANAGEMENT:
      return await handleCampaignTool(name, toolArgs, apiClient, withRetry);
    // case ToolCategory.EMAIL_ACCOUNT_MANAGEMENT:
  • The dispatcher switch case in handleCampaignTool that routes to the specific handler function for this tool name.
    case 'smartlead_get_campaign_analytics_by_date': {
      return handleGetCampaignAnalyticsByDate(args, apiClient, withRetry);
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states this is a fetch operation (likely read-only) but doesn't disclose any behavioral traits such as authentication requirements, rate limits, error conditions, pagination, or what format the analytics data returns. For a tool with no annotations, this leaves significant gaps in understanding how it behaves.

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 with zero wasted words. It's appropriately sized for a simple fetch operation and front-loads the key information (action, resource, scope).

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 no annotations, no output schema, and multiple similar sibling tools, the description is incomplete. It doesn't explain what 'analytics' includes, how results are structured, or how this differs from other campaign analytics tools. For a tool with contextual complexity (many siblings) and no structured support, more guidance is needed.

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%, with all parameters well-documented in the input schema. The description adds no additional parameter semantics beyond implying date-range filtering, which is already clear from the schema. This meets the baseline of 3 when the schema does the heavy lifting.

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 ('campaign analytics'), specifying the scope ('for a specific date range'). It distinguishes from general campaign analytics tools but doesn't explicitly differentiate from similar date-range siblings like 'smartlead_get_campaign_statistics_by_date' or 'smartlead_get_campaign_top_level_analytics_by_date'.

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. With multiple sibling tools that also fetch campaign data by date (e.g., 'smartlead_get_campaign_statistics_by_date'), the description lacks any context about 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