smartlead_delete_smart_delivery_tests
Remove multiple Smart Delivery spam tests in bulk by specifying their IDs to clean up test data and manage email marketing campaigns.
Instructions
Delete multiple Smart Delivery tests in bulk.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| spamTestIds | Yes | Array of spam test IDs to delete |
Implementation Reference
- src/handlers/smartDelivery.ts:306-344 (handler)The main handler function for the tool. Validates input parameters using isDeleteSmartDeliveryTestsParams, makes a POST request to the Smart Delivery API endpoint '/spam-test/delete', and returns the JSON response or an error message.async function handleDeleteSmartDeliveryTests( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isDeleteSmartDeliveryTestsParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_delete_smart_delivery_tests' ); } try { const smartDeliveryClient = createSmartDeliveryClient(apiClient); const response = await withRetry( async () => smartDeliveryClient.post('/spam-test/delete', args), 'delete smart delivery tests' ); 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:190-205 (schema)Defines the tool metadata including name, description, category, and input schema requiring spamTestIds as an array of integers.export const DELETE_SMART_DELIVERY_TESTS_TOOL: CategoryTool = { name: 'smartlead_delete_smart_delivery_tests', description: 'Delete multiple Smart Delivery tests in bulk.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { spamTestIds: { type: 'array', items: { type: 'integer' }, description: 'Array of spam test IDs to delete', }, }, required: ['spamTestIds'], }, };
- src/types/smartDelivery.ts:234-242 (schema)Type guard (validator) function that checks if input args conform to the DeleteSmartDeliveryTestsParams interface (object with spamTestIds: number[]). Used in the handler for input validation.export function isDeleteSmartDeliveryTestsParams(args: unknown): args is DeleteSmartDeliveryTestsParams { return ( typeof args === 'object' && args !== null && 'spamTestIds' in args && Array.isArray((args as DeleteSmartDeliveryTestsParams).spamTestIds) && (args as DeleteSmartDeliveryTestsParams).spamTestIds.every(id => typeof id === 'number') ); }
- src/index.ts:217-219 (registration)Registers the array of smartDeliveryTools (including this tool) with the toolRegistry when the smartDelivery category is enabled by license/feature flags.if (enabledCategories.smartDelivery) { toolRegistry.registerMany(smartDeliveryTools); }