Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_spam_test_details

Retrieve detailed results for a specific email spam test to analyze deliverability and identify potential inbox placement issues.

Instructions

Retrieve details of a specific spam test by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spam_test_idYesID of the spam test to retrieve details for

Implementation Reference

  • Core handler function that validates input parameters, makes API call to retrieve spam test details from SmartDelivery endpoint `/spam-test/${spam_test_id}`, formats response as MCP content, and handles errors.
    async function handleGetSpamTestDetails(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isGetSpamTestDetailsParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_spam_test_details'
        );
      }
    
      try {
        const smartDeliveryClient = createSmartDeliveryClient(apiClient);
        const { spam_test_id } = args;
        
        const response = await withRetry(
          async () => smartDeliveryClient.get(`/spam-test/${spam_test_id}`),
          'get spam test details'
        );
    
        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,
        };
      }
    }
  • MCP tool definition including name, description, category, and JSON schema for input validation (requires spam_test_id as integer).
    export const GET_SPAM_TEST_DETAILS_TOOL: CategoryTool = {
      name: 'smartlead_get_spam_test_details',
      description: 'Retrieve details of a specific spam test by ID.',
      category: ToolCategory.SMART_DELIVERY,
      inputSchema: {
        type: 'object',
        properties: {
          spam_test_id: {
            type: 'integer',
            description: 'ID of the spam test to retrieve details for',
          },
        },
        required: ['spam_test_id'],
      },
    };
  • TypeScript type guard function used in the handler to validate input arguments against GetSpamTestDetailsParams interface (checks for spam_test_id number).
    export function isGetSpamTestDetailsParams(args: unknown): args is GetSpamTestDetailsParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'spam_test_id' in args &&
        typeof (args as GetSpamTestDetailsParams).spam_test_id === 'number'
      );
    }
  • Switch case in handleSmartDeliveryTool that registers and dispatches the tool call to the specific handler function.
    case 'smartlead_get_spam_test_details': {
      return handleGetSpamTestDetails(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