Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_campaign

Retrieve detailed information about a specific email marketing campaign using its unique ID to monitor performance and track campaign metrics.

Instructions

Get details of a specific campaign by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to retrieve

Implementation Reference

  • The handler function that validates input, makes the API GET request to /campaigns/{campaign_id}, and returns the campaign details or error.
    async function handleGetCampaign(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetCampaignParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_campaign'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.get(`/campaigns/${args.campaign_id}`),
          'get 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 schema definition including name, description, category, and input schema requiring 'campaign_id'.
    export const GET_CAMPAIGN_TOOL: CategoryTool = {
      name: 'smartlead_get_campaign',
      description: 'Get details of a specific campaign by ID.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to retrieve',
          },
        },
        required: ['campaign_id'],
      },
    };
  • src/index.ts:197-199 (registration)
    Registers the campaignTools array (which includes smartlead_get_campaign) with the tool registry if campaignManagement category is enabled.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • Type guard function used in the handler to validate that input args contain a valid 'campaign_id' number.
    export function isGetCampaignParams(args: unknown): args is GetCampaignParams {
      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' calls to the specific handleGetCampaign function.
    case 'smartlead_get_campaign': {
      return handleGetCampaign(args, apiClient, withRetry);
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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