smartlead_delete_folder
Remove a folder from Smart Delivery by specifying its folder ID, enabling users to maintain organized email marketing campaigns.
Instructions
Delete a folder from Smart Delivery.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder_id | Yes | ID of the folder to delete |
Implementation Reference
- src/handlers/smartDelivery.ts:1213-1252 (handler)The core handler function that validates the input arguments using isDeleteFolderParams and executes the DELETE API request to the Smart Delivery endpoint `/spam-test/folder/{folder_id}` to delete the specified folder.async function handleDeleteFolder( args: unknown, apiClient: AxiosInstance, withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T> ) { if (!isDeleteFolderParams(args)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid arguments for smartlead_delete_folder' ); } try { const smartDeliveryClient = createSmartDeliveryClient(apiClient); const { folder_id } = args; const response = await withRetry( async () => smartDeliveryClient.delete(`/spam-test/folder/${folder_id}`), 'delete folder' ); 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:564-578 (schema)MCP tool schema definition with input schema specifying the required folder_id parameter as integer.export const DELETE_FOLDER_TOOL: CategoryTool = { name: 'smartlead_delete_folder', description: 'Delete a folder from Smart Delivery.', category: ToolCategory.SMART_DELIVERY, inputSchema: { type: 'object', properties: { folder_id: { type: 'integer', description: 'ID of the folder to delete', }, }, required: ['folder_id'], }, };
- src/types/smartDelivery.ts:423-430 (schema)Type guard function used for input validation, confirming args is an object containing a numeric folder_id.export function isDeleteFolderParams(args: unknown): args is DeleteFolderParams { return ( typeof args === 'object' && args !== null && 'folder_id' in args && typeof (args as DeleteFolderParams).folder_id === 'number' ); }
- src/index.ts:217-219 (registration)Registers the smartDeliveryTools array (including smartlead_delete_folder) with the tool registry if the smartDelivery category is enabled by license.if (enabledCategories.smartDelivery) { toolRegistry.registerMany(smartDeliveryTools); }
- src/handlers/smartDelivery.ts:122-124 (registration)Switch case in handleSmartDeliveryTool that routes calls to the specific delete folder handler.case 'smartlead_delete_folder': { return handleDeleteFolder(args, apiClient, withRetry); }