Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_delete_campaign

Permanently delete a specific email marketing campaign by its ID using the Smartlead Simplified MCP Server to manage your campaign list.

Instructions

Delete a campaign permanently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to delete

Implementation Reference

  • The primary handler function that implements the tool logic: validates input using isDeleteCampaignParams, makes a DELETE API call to `/campaigns/${campaign_id}`, and returns the response or error.
    async function handleDeleteCampaign(
      args: unknown, 
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isDeleteCampaignParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_delete_campaign'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.delete(`/campaigns/${args.campaign_id}`),
          'delete campaign'
        );
    
        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,
        };
      }
  • Tool schema definition including name, description, category, and input schema requiring 'campaign_id'.
    export const DELETE_CAMPAIGN_TOOL: CategoryTool = {
      name: 'smartlead_delete_campaign',
      description: 'Delete a campaign permanently.',
      category: ToolCategory.CAMPAIGN_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          campaign_id: {
            type: 'number',
            description: 'ID of the campaign to delete',
          },
        },
        required: ['campaign_id'],
      },
    };
  • Runtime type guard (isDeleteCampaignParams) and TypeScript interface (DeleteCampaignParams) for input validation.
    export function isDeleteCampaignParams(args: unknown): args is DeleteCampaignParams {
      return (
        typeof args === 'object' &&
        args !== null &&
        'campaign_id' in args &&
        typeof (args as { campaign_id: unknown }).campaign_id === 'number'
      );
    }
  • src/index.ts:197-199 (registration)
    Registers the campaign tools (including smartlead_delete_campaign) with the tool registry if the category is enabled.
    if (enabledCategories.campaignManagement) {
      toolRegistry.registerMany(campaignTools);
    }
  • Switch case in handleCampaignTool that routes the tool call to the specific handleDeleteCampaign function.
    case 'smartlead_delete_campaign': {
      return handleDeleteCampaign(args, apiClient, withRetry);
    }

Tool Definition Quality

Score is being calculated. Check back soon.

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