Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Remove Contacts from a Specific List

remove_contact_from_lists

Remove specific contacts from an email marketing list in SendGrid to manage subscriber data and maintain list accuracy.

Instructions

Remove contacts from a specific email list

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesID of the list to remove contacts from
contact_idsYesArray of contact IDs to remove from the list

Implementation Reference

  • The main handler function that implements the remove_contact_from_lists tool by sending a DELETE request to the SendGrid API to remove specified contacts from a given list, with read-only mode check.
    handler: async ({ list_id, contact_ids }: { list_id: string; 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/lists/${list_id}/contacts?contact_ids=${contact_ids.join(',')}`, {
        method: "DELETE",
      });
      return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    },
  • Configuration including title, description, and Zod input schema for validating list_id (string) and contact_ids (array of strings).
    config: {
      title: "Remove Contacts from a Specific List",
      description: "Remove contacts from a specific email list",
      inputSchema: {
        list_id: z.string().describe("ID of the list to remove contacts from"),
        contact_ids: z.array(z.string()).describe("Array of contact IDs to remove from the list"),
      },
    },
  • Imports contactTools (which contains remove_contact_from_lists) and spreads it into the allTools object for top-level registration.
    import { contactTools } from "./contacts.js";
    import { mailTools } from "./mail.js";
    import { miscTools } from "./misc.js";
    import { statsTools } from "./stats.js";
    import { templateTools } from "./templates.js";
    
    export const allTools = {
      ...automationTools,
  • src/index.ts:5-23 (registration)
    Imports allTools and loops through to register each tool (including remove_contact_from_lists) with the MCP server using registerTool.
    import { allTools } from "./tools/index.js";
    import { allResources } from "./resources/index.js";
    import { allPrompts } from "./prompts/index.js";
    import { validateEnvironment, getSafeEnvInfo } from "./shared/env.js";
    
    const server = new McpServer({
      name: "sendgrid-mcp",
      version: "1.0.0",
    });
    
    // Register all resources
    for (const [uri, resource] of Object.entries(allResources)) {
      server.registerResource(uri, uri, resource.config, resource.handler);
    }
    
    // Register all tools
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Remove' implies a mutation operation, the description doesn't specify whether this is reversible, what permissions are required, whether it affects contact data globally or just list membership, or what happens if contact_ids are invalid. 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 wasted words. It's appropriately sized for a simple tool and front-loads the core action and target.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like reversibility, error handling, or response format, nor does it differentiate from sibling tools. Given the complexity of contact/list management and the lack of structured data, more context is needed.

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%, with both parameters (list_id and contact_ids) clearly documented in the schema. The description adds no additional parameter semantics beyond what's in the schema (e.g., format examples, constraints, or relationships). Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('Remove contacts') and target resource ('from a specific email list'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'delete_contact' or 'update_contact', which might handle contact removal differently.

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 like 'delete_contact' (which might permanently delete contacts) or 'update_contact' (which might modify contact properties). There's no mention of prerequisites, context, or exclusions for usage.

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

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