delete_email_list
Remove an email list from your SendGrid account to manage contacts and clean up outdated or unused mailing lists.
Instructions
Delete an existing email list from your SendGrid account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ID of the email list to delete |
Implementation Reference
- src/tools/contacts.ts:74-84 (handler)The main handler function that executes the delete_email_list tool. It checks for read-only mode, then makes a DELETE request to the SendGrid Marketing Lists API endpoint to delete the list by ID.handler: async ({ list_id }: { list_id: string }): Promise<ToolResult> => { const readOnlyCheck = checkReadOnlyMode(); if (readOnlyCheck.blocked) { return { content: [{ type: "text", text: readOnlyCheck.message! }] }; } const result = await makeRequest(`https://api.sendgrid.com/v3/marketing/lists/${list_id}`, { method: "DELETE", }); return { content: [{ type: "text", text: `List ${list_id} deleted successfully.` }] }; },
- src/tools/contacts.ts:67-73 (schema)The tool's configuration object, including title, description, and Zod input schema defining the required 'list_id' string parameter.config: { title: "Delete Email List", description: "Delete an existing email list from your SendGrid account", inputSchema: { list_id: z.string().describe("ID of the email list to delete"), }, },
- src/index.ts:22-23 (registration)The MCP server registration loop that dynamically registers the delete_email_list tool (along with all others from allTools) using its config and handler.server.registerTool(name, tool.config as any, tool.handler as any); }