Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_create_campaign

Create new email marketing campaigns in Smartlead by defining campaign names and client IDs to organize and launch targeted email outreach.

Instructions

Create a new campaign in Smartlead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
client_idNoClient ID for the campaign
nameYesName of the campaign

Implementation Reference

  • Core handler function that executes the smartlead_create_campaign tool: validates input parameters using isCreateCampaignParams, performs POST request to Smartlead API /campaigns/create endpoint with retry logic, formats and returns the response or error.
    async function handleCreateCampaign(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isCreateCampaignParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_create_campaign'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.post('/campaigns/create', args),
          'create campaign'
        );
    
        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 JSON schema for input validation of smartlead_create_campaign.
    export const CREATE_CAMPAIGN_TOOL: CategoryTool = {
      name: 'smartlead_create_campaign',
      description: 'Create a new campaign in Smartlead.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the campaign',
          },
          client_id: {
            type: 'number',
            description: 'Client ID for the campaign',
          },
        },
        required: ['name'],
      },
    };
  • TypeScript interface and runtime type guard (isCreateCampaignParams) for input parameters used in the handler validation.
    // Type definitions for campaign management
    
    export interface CreateCampaignParams {
      name: string;
      client_id?: number;
    }
    
    export interface UpdateCampaignScheduleParams {
      campaign_id: number;
      timezone?: string;
      days_of_the_week?: number[];
      start_hour?: string;
      end_hour?: string;
      min_time_btw_emails?: number;
      max_new_leads_per_day?: number;
      schedule_start_time?: string;
    }
    
    export interface UpdateCampaignSettingsParams {
      campaign_id: number;
      name?: string;
      status?: 'active' | 'paused' | 'completed';
      settings?: Record<string, any>;
    }
    
    export interface UpdateCampaignStatusParams {
      campaign_id: number;
      status: 'PAUSED' | 'STOPPED' | 'START';
    }
    
    export interface GetCampaignParams {
      campaign_id: number;
    }
    
    export interface GetCampaignSequenceParams {
      campaign_id: number;
    }
    
    export interface ListCampaignsParams {
      status?: 'active' | 'paused' | 'completed';
      limit?: number;
      offset?: number;
    }
    
    export interface SaveCampaignSequenceParams {
      campaign_id: number;
      sequence: Array<{
        seq_number: number;
        seq_delay_details: {
          delay_in_days: number;
        };
        variant_distribution_type: 'MANUAL_EQUAL' | 'MANUAL_PERCENTAGE' | 'AI_EQUAL';
        lead_distribution_percentage?: number;
        winning_metric_property?: 'OPEN_RATE' | 'CLICK_RATE' | 'REPLY_RATE' | 'POSITIVE_REPLY_RATE';
        seq_variants: Array<{
          subject: string;
          email_body: string;
          variant_label: string;
          id?: number;
          variant_distribution_percentage?: number;
        }>;
      }>;
    }
    
    // New interface definitions for remaining campaign management endpoints
    export interface GetCampaignsByLeadParams {
      lead_id: number;
    }
    
    export interface ExportCampaignLeadsParams {
      campaign_id: number;
    }
    
    export interface DeleteCampaignParams {
      campaign_id: number;
    }
    
    export interface GetCampaignAnalyticsByDateParams {
      campaign_id: number;
      start_date: string;
      end_date: string;
    }
    
    export interface GetCampaignSequenceAnalyticsParams {
      campaign_id: number;
      start_date: string;
      end_date: string;
      time_zone?: string;
    }
    
    // Type guards
    export function isCreateCampaignParams(args: unknown): args is CreateCampaignParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'name' in args &&
        typeof (args as { name: unknown }).name === 'string'
      );
    }
  • src/index.ts:197-199 (registration)
    Registers the array of campaign tools (including smartlead_create_campaign) to the toolRegistry if the campaignManagement category is enabled by license/features.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • src/index.ts:346-347 (registration)
    In the main CallToolRequest handler, dispatches to handleCampaignTool for tools in CAMPAIGN_MANAGEMENT category, which routes to the specific create campaign handler.
    case ToolCategory.CAMPAIGN_MANAGEMENT:
      return await handleCampaignTool(name, toolArgs, 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 the full burden of behavioral disclosure. It states 'Create' implies a write operation, but doesn't mention permissions required, whether the campaign is immediately active, what happens on failure, or any rate limits. For a mutation tool with zero annotation coverage, this is a significant gap in transparency.

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 any wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 is a mutation operation (creating a campaign) with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error handling, or what the response might contain, making it incomplete for effective agent use in a complex environment with many sibling tools.

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 the schema already documents both parameters ('client_id' and 'name') with their types and requirements. The description adds no additional meaning beyond what the schema provides, such as format examples or constraints, resulting in the baseline score of 3.

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 ('Create') and resource ('new campaign in Smartlead'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'smartlead_update_campaign_settings' or 'smartlead_update_campaign_status' that also involve campaign operations, missing an opportunity for precise distinction.

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 like 'smartlead_update_campaign_settings' or 'smartlead_list_campaigns', there's no indication of prerequisites, typical scenarios, or exclusions, leaving usage entirely implicit.

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