Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign_sequence

Retrieve email sequence data for a specific campaign to analyze email marketing performance and track communication flows.

Instructions

Fetch a campaign's sequence data.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to fetch sequences for

Implementation Reference

  • Handler function that validates input, calls Smartlead API endpoint `/campaigns/{campaign_id}/sequences`, formats response as JSON text, and handles errors.
    async function handleGetCampaignSequence(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetCampaignSequenceParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign_sequence'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${args.campaign_id}/sequences`),
          'get campaign sequence'
        );
    
        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 input schema requiring `campaign_id` (number).
    export const GET_CAMPAIGN_SEQUENCE_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign_sequence',
      description: 'Fetch a campaign\'s sequence data.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to fetch sequences for',
          },
        },
        required: ['campaign_id'],
      },
    };
  • src/index.ts:197-199 (registration)
    Registers the campaignTools array (which includes smartlead_get_campaign_sequence) to the tool registry if campaignManagement category is enabled.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • Runtime type guard/validator for input parameters, ensuring `campaign_id` is present and a number.
    export function isGetCampaignSequenceParams(args: unknown): args is GetCampaignSequenceParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'campaign_id' in args &&
        typeof (args as { campaign_id: unknown }).campaign_id === 'number'
      );
    }
  • Switch case in handleCampaignTool that routes 'smartlead_get_campaign_sequence' calls to the specific handler function.
    case 'smartlead_get_campaign_sequence': {
      return handleGetCampaignSequence(args, apiClient, withRetry);
    }
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