delete_contact
Remove contacts from your SendGrid email marketing list by specifying their unique IDs to manage your subscriber database.
Instructions
Delete contacts by IDs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contact_ids | Yes | Array of contact IDs to delete |
Implementation Reference
- src/tools/contacts.ts:316-326 (handler)Handler function that checks read-only mode and deletes the specified contacts via SendGrid API DELETE /v3/marketing/contacts?ids=... request.handler: async ({ contact_ids }: { contact_ids: 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/contacts?ids=${contact_ids.join(',')}`, { method: "DELETE", }); return { content: [{ type: "text", text: `${contact_ids.length} contact(s) deleted successfully.\n\n${JSON.stringify(result, null, 2)}` }] }; },
- src/tools/contacts.ts:309-315 (schema)Tool configuration with title, description, and Zod input schema validating an array of contact IDs.config: { title: "Delete Contact", description: "Delete contacts by IDs", inputSchema: { contact_ids: z.array(z.string()).describe("Array of contact IDs to delete"), }, },
- src/index.ts:21-23 (registration)Registers all tools including 'delete_contact' with the MCP server by iterating over allTools.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
- src/tools/index.ts:12-12 (registration)Includes contactTools (containing delete_contact) in the aggregated allTools export....contactTools,