Skip to main content
Glama
Garoth

SendGrid MCP Server

by Garoth

delete_contacts

Remove email addresses from your SendGrid contact database to maintain clean mailing lists and comply with data privacy requirements.

Instructions

Delete contacts from your SendGrid account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emailsYesArray of email addresses to delete

Implementation Reference

  • Core handler function that implements deleting SendGrid contacts by first searching for them by email addresses and then deleting them using the SendGrid Marketing Contacts API.
    async deleteContactsByEmails(emails: string[]): Promise<void> {
      // First get the contact IDs for the emails
      const [searchResponse] = await this.client.request({
        method: 'POST',
        url: '/v3/marketing/contacts/search',
        body: {
          query: `email IN (${emails.map(email => `'${email}'`).join(',')})`
        }
      });
      
      const contacts = (searchResponse.body as { result: SendGridContact[] }).result || [];
      const contactIds = contacts.map(contact => contact.id).filter(id => id) as string[];
    
      if (contactIds.length > 0) {
        // Then delete the contacts by their IDs
        await this.client.request({
          method: 'DELETE',
          url: '/v3/marketing/contacts',
          qs: {
            ids: contactIds.join(',')
          }
        });
      }
    }
  • Tool registration within getToolDefinitions array, defining name, description, and input schema for the delete_contacts tool.
    {
      name: 'delete_contacts',
      description: 'Delete contacts from your SendGrid account',
      inputSchema: {
        type: 'object',
        properties: {
          emails: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'Array of email addresses to delete'
          }
        },
        required: ['emails']
      }
    },
  • Input schema definition specifying that delete_contacts requires an array of email strings.
    inputSchema: {
      type: 'object',
      properties: {
        emails: {
          type: 'array',
          items: {
            type: 'string'
          },
          description: 'Array of email addresses to delete'
        }
      },
      required: ['emails']
    }
  • Dispatcher in handleToolCall that invokes the deleteContactsByEmails service method and formats the tool response.
    case 'delete_contacts':
      await service.deleteContactsByEmails(args.emails);
      return { content: [{ type: 'text', text: `Successfully deleted ${args.emails.length} contacts` }] };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates a destructive operation ('Delete'), but fails to specify whether deletions are permanent, reversible, require specific permissions, or have rate limits. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero wasted words, making it highly efficient and front-loaded. It directly communicates the core function without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature and lack of annotations or output schema, the description is insufficient. It doesn't address critical aspects like confirmation needs, error handling, or return values, leaving the agent with incomplete context for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, so the schema already documents the 'emails' parameter as an array of email addresses to delete. The description adds no additional meaning beyond this, such as format requirements or deletion scope, resulting in a baseline score of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Delete') and resource ('contacts from your SendGrid account'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'delete_list' or 'remove_contacts_from_list', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'delete_list' or 'remove_contacts_from_list', nor does it mention prerequisites like authentication or confirmation steps. It only states what the tool does, not when or why to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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