Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_email_headers

Retrieve detailed email header information for specific spam tests and replies to analyze email delivery and authentication data.

Instructions

Get details of the email headers for a specific email.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
reply_idYesID of the email received by the seed account
spam_test_idYesID of the spam test

Implementation Reference

  • The handler function that performs input validation and makes the API call to retrieve email headers for the specified spam test and reply ID.
    async function handleGetEmailHeaders(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isEmailHeadersParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_email_headers'
        );
      }
    
      try {
        const smartDeliveryClient = createSmartDeliveryClient(apiClient);
        const { spam_test_id, reply_id } = args;
        
        const response = await withRetry(
          async () => smartDeliveryClient.get(`/spam-test/report/${spam_test_id}/sender-account-wise/${reply_id}/email-headers`),
          'get email headers'
        );
    
        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,
        };
      }
    }
  • Schema definition for the tool, specifying input parameters spam_test_id and reply_id.
    export const GET_EMAIL_HEADERS_TOOL: CategoryTool = {
      name: 'smartlead_get_email_headers',
      description: 'Get details of the email headers for a specific email.',
      category: ToolCategory.SMART_DELIVERY,
      inputSchema: {
        type: 'object',
        properties: {
          spam_test_id: {
            type: 'integer',
            description: 'ID of the spam test',
          },
          reply_id: {
            type: 'integer',
            description: 'ID of the email received by the seed account',
          },
        },
        required: ['spam_test_id', 'reply_id'],
      },
    };
  • src/index.ts:216-219 (registration)
    Registration of all smartDeliveryTools (including this tool) into the tool registry if the smartDelivery category is enabled.
    // Register smart delivery tools if enabled
    if (enabledCategories.smartDelivery) {
      toolRegistry.registerMany(smartDeliveryTools);
    }
  • Switch case in handleSmartDeliveryTool that routes to the specific handler for this tool.
    case 'smartlead_get_email_headers': {
      return handleGetEmailHeaders(args, apiClient, withRetry);
    }
  • src/index.ts:354-355 (registration)
    Main tool dispatcher switch case that routes SMART_DELIVERY category tools to handleSmartDeliveryTool.
    case ToolCategory.SMART_DELIVERY:
      return await handleSmartDeliveryTool(name, toolArgs, 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