Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Delete Segment

delete_segment

Remove a contact segment from your SendGrid email marketing lists to maintain organized audience targeting.

Instructions

Delete an existing segment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
segment_idYesID of the segment to delete

Implementation Reference

  • The handler function that performs the actual deletion of a segment using SendGrid's API DELETE request, with read-only mode check.
    handler: async ({ segment_id }: { segment_id: 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/segments/2.0/${segment_id}`, {
        method: "DELETE",
      });
      return { content: [{ type: "text", text: `Segment ${segment_id} deleted successfully.` }] };
    },
  • The tool's configuration including title, description, and Zod input schema validating the segment_id parameter.
    config: {
      title: "Delete Segment",
      description: "Delete an existing segment",
      inputSchema: {
        segment_id: z.string().describe("ID of the segment to delete"),
      },
    },
  • Local registration of contactTools (containing delete_segment) into the allTools object by spreading.
    import { campaignTools } from "./campaigns.js";
    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,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
    };
  • src/index.ts:5-23 (registration)
    Top-level registration loop that registers all tools from allTools (including delete_segment) with the MCP server.
    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 full burden for behavioral disclosure. 'Delete' implies a destructive mutation, but the description doesn't state whether this action is permanent, requires confirmation, has side effects (e.g., removing contacts from the segment), or what happens on success/failure. For a destructive tool with zero annotation coverage, this is a significant gap in transparency.

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 maximally concise with just three words that directly convey the core function. Every word earns its place, and there's no redundancy or unnecessary elaboration. The structure is front-loaded with the essential information.

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 destructive mutation tool with no annotations and no output schema, the description is inadequate. It doesn't address critical context like whether deletion is permanent, what permissions are needed, what happens to associated data, or what the tool returns. Given the complexity of a delete operation and the lack of structured metadata, the description should provide more behavioral context.

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 a single parameter 'segment_id' clearly documented in the schema. The description adds no additional parameter information beyond what's in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

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 the resource ('an existing segment'), making the purpose immediately understandable. It distinguishes from siblings like 'delete_contact' or 'delete_template' by specifying the segment resource. However, it doesn't explicitly mention what a 'segment' is in this context, which could help further differentiate it from other deletion tools.

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. With siblings like 'update_segment' and 'list_segments', there's no indication whether deletion is irreversible, requires specific permissions, or should be used only after checking dependencies. The description lacks any context about prerequisites or alternatives.

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