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
| Name | Required | Description | Default |
|---|---|---|---|
| spam_test_id | Yes | ID of the automated spam test to get the schedule history for |
Implementation Reference
- src/handlers/smartDelivery.ts:920-959 (handler)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, }; } }
- src/tools/smartDelivery.ts:444-458 (schema)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); }
- src/handlers/smartDelivery.ts:101-103 (registration)Routes the tool call to the specific handleGetScheduleHistory implementation within the SmartDelivery tool dispatcher.case 'smartlead_get_schedule_history': { return handleGetScheduleHistory(args, apiClient, withRetry); }
- src/types/smartDelivery.ts:373-380 (helper)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' ); }