Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

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
NameRequiredDescriptionDefault
folder_idYesID of the folder to delete

Implementation Reference

  • 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,
        };
      }
    }
  • 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'],
      },
    };
  • 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);
    }
  • Switch case in handleSmartDeliveryTool that routes calls to the specific delete folder handler.
    case 'smartlead_delete_folder': {
      return handleDeleteFolder(args, apiClient, withRetry);
    }
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