Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

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
NameRequiredDescriptionDefault
contact_idsYesArray of contact IDs to delete

Implementation Reference

  • 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)}` }] };
    },
  • 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);
    }
  • Includes contactTools (containing delete_contact) in the aggregated allTools export.
    ...contactTools,

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/deyikong/sendgrid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server