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
| Name | Required | Description | Default |
|---|---|---|---|
| lead_id | Yes | ID of the lead to delete |
Implementation Reference
- src/handlers/lead.ts:306-342 (handler)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, }; } }
- src/tools/lead.ts:221-235 (schema)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); }
- src/handlers/lead.ts:39-41 (registration)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);