Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_email_content

Retrieve email content details including raw and HTML versions along with campaign and sequence information for a specific spam test ID.

Instructions

Get details for the email content (raw, HTML) along with campaign and sequence details.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spam_test_idYesID of the spam test to get the email content for

Implementation Reference

  • Core execution logic for the smartlead_get_email_content tool. Validates arguments using isEmailContentParams, calls the SmartDelivery API GET /spam-test/report/{spam_test_id}/email-content endpoint, and formats the response as MCP tool result.
    async function handleGetEmailContent(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isEmailContentParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_email_content'
        );
      }
    
      try {
        const smartDeliveryClient = createSmartDeliveryClient(apiClient);
        const { spam_test_id } = args;
        
        const response = await withRetry(
          async () => smartDeliveryClient.get(`/spam-test/report/${spam_test_id}/email-content`),
          'get email content'
        );
    
        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 specifying the name, description, category, and input schema (requires spam_test_id as integer). Used for MCP tool registration and validation.
    export const GET_EMAIL_CONTENT_TOOL: CategoryTool = {
      name: 'smartlead_get_email_content',
      description: 'Get details for the email content (raw, HTML) along with campaign and sequence details.',
      category: ToolCategory.SMART_DELIVERY,
      inputSchema: {
        type: 'object',
        properties: {
          spam_test_id: {
            type: 'integer',
            description: 'ID of the spam test to get the email content for',
          },
        },
        required: ['spam_test_id'],
      },
    };
  • src/index.ts:217-219 (registration)
    Registers the array of smartDeliveryTools (including smartlead_get_email_content schema) to the MCP tool registry if smartDelivery category is license-enabled.
    if (enabledCategories.smartDelivery) {
      toolRegistry.registerMany(smartDeliveryTools);
    }
  • Runtime type guard function isEmailContentParams used in the handler for input validation, matching the tool inputSchema.
    export function isEmailContentParams(args: unknown): args is EmailContentParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'spam_test_id' in args &&
        typeof (args as EmailContentParams).spam_test_id === 'number'
      );
    }
  • src/index.ts:354-356 (registration)
    Registers the category dispatcher handleSmartDeliveryTool for all SMART_DELIVERY tools, which routes to specific handlers based on tool name.
    case ToolCategory.SMART_DELIVERY:
      return await handleSmartDeliveryTool(name, toolArgs, apiClient, withRetry);
    case ToolCategory.WEBHOOKS:

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