Skip to main content
Glama
Garoth

SendGrid MCP Server

by Garoth

remove_contacts_from_list

Remove email addresses from a SendGrid contact list while preserving the contacts in your database. Specify list ID and emails to manage your email marketing audience.

Instructions

Remove contacts from a SendGrid list without deleting them

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesID of the contact list
emailsYesArray of email addresses to remove from the list

Implementation Reference

  • Handler for the 'remove_contacts_from_list' tool call. It invokes the service method with list_id and emails, then returns a success message.
    case 'remove_contacts_from_list':
      await service.removeContactsFromList(args.list_id, args.emails);
      return { content: [{ type: 'text', text: `Removed ${args.emails.length} contacts from list ${args.list_id}` }] };
  • Schema definition for the 'remove_contacts_from_list' tool, including name, description, and inputSchema with required properties list_id and emails.
    {
      name: 'remove_contacts_from_list',
      description: 'Remove contacts from a SendGrid list without deleting them',
      inputSchema: {
        type: 'object',
        properties: {
          list_id: {
            type: 'string',
            description: 'ID of the contact list'
          },
          emails: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'Array of email addresses to remove from the list'
          }
        },
        required: ['list_id', 'emails']
      }
    }
  • Helper method in SendGridService that implements the core logic: searches for contacts by email within the specified list, retrieves their IDs, and deletes the associations from the list via SendGrid API.
    async removeContactsFromList(listId: string, contactEmails: string[]) {
      // 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 (${contactEmails.map(email => `'${email}'`).join(',')}) AND CONTAINS(list_ids, '${listId}')`
        }
      });
      
      const contacts = (searchResponse.body as { result: SendGridContact[] }).result || [];
      const contactIds = contacts.map(contact => contact.id).filter(id => id) as string[];
    
      if (contactIds.length > 0) {
        // Remove the contacts from the list
        await this.client.request({
          method: 'DELETE',
          url: `/v3/marketing/lists/${listId}/contacts`,
          qs: {
            contact_ids: contactIds.join(',')
          }
        });
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it clarifies that contacts are removed 'without deleting them' (important context), it doesn't address other behavioral aspects like required permissions, rate limits, error conditions, or what happens to contacts removed from lists. For a mutation tool with zero annotation coverage, this is insufficient.

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, efficient sentence with zero waste. It's front-loaded with the core purpose and includes important qualifying information ('without deleting them') that earns its place. No unnecessary words or redundant information.

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

Completeness3/5

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

For a mutation tool with no annotations and no output schema, the description provides the essential purpose and distinguishes it from deletion operations. However, it lacks information about what the tool returns, error handling, or side effects. Given the complexity level and missing structured data, this is minimally adequate but has clear gaps.

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?

Schema description coverage is 100%, so both parameters are already documented in the schema. The description doesn't add any parameter-specific information beyond what the schema provides. The baseline score of 3 is appropriate when the schema does the heavy lifting for parameter documentation.

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

Purpose5/5

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

The description clearly states the specific action ('Remove contacts from a SendGrid list') and distinguishes it from sibling tools by specifying 'without deleting them', which differentiates it from delete_contacts and delete_list. It provides verb+resource+scope in a single concise statement.

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

Usage Guidelines4/5

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

The description provides clear context about when to use this tool ('Remove contacts from a SendGrid list') and implicitly distinguishes it from deletion operations. However, it doesn't explicitly state when NOT to use it or name specific alternatives like delete_contacts for permanent removal.

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