smartlead_stop_automated_test
Stop an active automated email marketing test before its scheduled end date by providing the test ID. This allows users to halt tests that are no longer needed or require adjustment.
Instructions
Stop an active automated test before its end date.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spam_test_id | Yes | ID of the automated test to stop |
Implementation Reference
- src/handlers/smartDelivery.ts:346-385 (handler)Core handler function that validates input parameters using isStopAutomatedTestParams, creates a SmartDelivery API client, sends a PUT request to stop the automated test by spam_test_id, and returns the JSON response or error message.async function handleStopAutomatedTest( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isStopAutomatedTestParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_stop_automated_test' ); } try { const smartDeliveryClient = createSmartDeliveryClient(apiClient); const { spam_test_id } = args; const response = await withRetry( async () => smartDeliveryClient.put(`/spam-test/${spam_test_id}/stop`), 'stop automated test' ); 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:207-221 (schema)Tool definition including name, description, category, and input schema requiring a spam_test_id integer.export const STOP_AUTOMATED_TEST_TOOL: CategoryTool = { name: 'smartlead_stop_automated_test', description: 'Stop an active automated test before its end date.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { spam_test_id: { type: 'integer', description: 'ID of the automated test to stop', }, }, required: ['spam_test_id'], }, };
- src/types/smartDelivery.ts:244-251 (schema)Type guard function that validates input arguments match StopAutomatedTestParams interface (object with numeric spam_test_id).export function isStopAutomatedTestParams(args: unknown): args is StopAutomatedTestParams { return ( typeof args === 'object' && args !== null && 'spam_test_id' in args && typeof (args as StopAutomatedTestParams).spam_test_id === 'number' ); }
- src/index.ts:217-219 (registration)Registers the array of smartDeliveryTools (which includes smartlead_stop_automated_test) into the tool registry if the smartDelivery category is enabled.if (enabledCategories.smartDelivery) { toolRegistry.registerMany(smartDeliveryTools); }
- src/handlers/smartDelivery.ts:59-61 (handler)Switch case in handleSmartDeliveryTool dispatcher that routes calls to this specific tool to its handler function.case 'smartlead_stop_automated_test': { return handleStopAutomatedTest(args, apiClient, withRetry); }