Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_get_schedule_history

Retrieve the complete schedule history and summary of all test runs for a specific automated spam test to track execution details and results.

Instructions

Get the list and summary of all tests that ran for a particular automated test.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
spam_test_idYesID of the automated spam test to get the schedule history for

Implementation Reference

  • The core handler function that validates input parameters using isScheduleHistoryParams, creates a SmartDelivery API client, fetches the schedule history from `/spam-test/report/${spam_test_id}/schedule-history` endpoint using retry logic, and returns formatted JSON response or error message.
    async function handleGetScheduleHistory(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isScheduleHistoryParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_get_schedule_history'
        );
      }
    
      try {
        const smartDeliveryClient = createSmartDeliveryClient(apiClient);
        const { spam_test_id } = args;
        
        const response = await withRetry(
          async () => smartDeliveryClient.get(`/spam-test/report/${spam_test_id}/schedule-history`),
          'get schedule history'
        );
    
        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,
        };
      }
    }
  • Defines the tool metadata including name, description, category (SMART_DELIVERY), and input schema that requires a single 'spam_test_id' parameter of type integer.
    export const GET_SCHEDULE_HISTORY_TOOL: CategoryTool = {
      name: 'smartlead_get_schedule_history',
      description: 'Get the list and summary of all tests that ran for a particular automated test.',
      category: ToolCategory.SMART_DELIVERY,
      inputSchema: {
        type: 'object',
        properties: {
          spam_test_id: {
            type: 'integer',
            description: 'ID of the automated spam test to get the schedule history for',
          },
        },
        required: ['spam_test_id'],
      },
    };
  • src/index.ts:217-219 (registration)
    Registers the smartDeliveryTools array (which includes smartlead_get_schedule_history) to the tool registry if the smartDelivery category is enabled by license/features.
    if (enabledCategories.smartDelivery) {
      toolRegistry.registerMany(smartDeliveryTools);
    }
  • Routes the tool call to the specific handleGetScheduleHistory implementation within the SmartDelivery tool dispatcher.
    case 'smartlead_get_schedule_history': {
      return handleGetScheduleHistory(args, apiClient, withRetry);
    }
  • Type guard function used for input validation, ensuring args is an object containing 'spam_test_id' as a number.
    export function isScheduleHistoryParams(args: unknown): args is ScheduleHistoryParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'spam_test_id' in args &&
        typeof (args as ScheduleHistoryParams).spam_test_id === 'number'
      );
    }

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