delete_contact
Remove contacts from your SendGrid account by specifying their unique IDs to maintain clean and current contact lists.
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)The main handler function that performs the DELETE request to the SendGrid API to delete specified contacts.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:312-314 (schema)Zod input schema defining the required 'contact_ids' array parameter.inputSchema: { contact_ids: z.array(z.string()).describe("Array of contact IDs to delete"), },
- src/index.ts:21-23 (registration)Registration loop that registers the 'delete_contact' tool (along with others) with the MCP server using registerTool.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)Spreads contactTools (including delete_contact) into the allTools export....contactTools,
- src/tools/contacts.ts:309-315 (schema)Full tool config including title, description, and input schema.config: { title: "Delete Contact", description: "Delete contacts by IDs", inputSchema: { contact_ids: z.array(z.string()).describe("Array of contact IDs to delete"), }, },