Skip to main content
Glama
jonathan-politzki

Smartlead Simplified MCP Server

smartlead_delete_lead

Remove a lead permanently from the Smartlead email marketing system by specifying the lead ID to maintain clean contact lists.

Instructions

Delete a lead permanently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lead_idYesID of the lead to delete

Implementation Reference

  • Core handler function that validates the input using isDeleteLeadParams, performs DELETE API request to /leads/{lead_id}, and returns the response or formatted error.
    async function handleDeleteLead(
      args: unknown,
      apiClient: AxiosInstance,
      withRetry: <T>(operation: () => Promise<T>, context: string) => Promise<T>
    ) {
      if (!isDeleteLeadParams(args)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid arguments for smartlead_delete_lead'
        );
      }
    
      try {
        const response = await withRetry(
          async () => apiClient.delete(`/leads/${args.lead_id}`),
          'delete lead'
        );
    
        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 that requires a numeric lead_id.
    export const DELETE_LEAD_TOOL: CategoryTool = {
      name: 'smartlead_delete_lead',
      description: 'Delete a lead permanently.',
      category: ToolCategory.LEAD_MANAGEMENT,
      inputSchema: {
        type: 'object',
        properties: {
          lead_id: {
            type: 'number',
            description: 'ID of the lead to delete',
          },
        },
        required: ['lead_id'],
      },
    };
  • src/index.ts:207-209 (registration)
    Registers the leadTools array (which includes smartlead_delete_lead) into the tool registry if leadManagement category is enabled.
    if (enabledCategories.leadManagement) {
      toolRegistry.registerMany(leadTools);
    }
  • Dispatches calls to smartlead_delete_lead to the specific handleDeleteLead function within the lead tool handler.
    case 'smartlead_delete_lead': {
      return handleDeleteLead(args, apiClient, withRetry);
    }
  • src/index.ts:350-351 (registration)
    Main MCP tool call handler dispatches lead management tools (including smartlead_delete_lead) to handleLeadTool.
    case ToolCategory.LEAD_MANAGEMENT:
      return await handleLeadTool(name, toolArgs, 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