Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Delete Custom Field

delete_custom_field

Remove a custom field definition from your SendGrid account by providing its unique field ID.

Instructions

Delete a custom field definition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
field_idYesID of the custom field to delete

Implementation Reference

  • Handler function that deletes a custom field definition by sending a DELETE request to SendGrid's marketing field_definitions API. It first checks read-only mode, then sends the DELETE request and returns a success message.
    delete_custom_field: {
      config: {
        title: "Delete Custom Field",
        description: "Delete a custom field definition",
        inputSchema: {
          field_id: z.string().describe("ID of the custom field to delete"),
        },
      },
      handler: async ({ field_id }: { field_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/field_definitions/${field_id}`, {
          method: "DELETE",
        });
        return { content: [{ type: "text", text: `Custom field ${field_id} deleted successfully.` }] };
      },
    },
  • Input schema for delete_custom_field, requiring a single field_id string parameter.
    config: {
      title: "Delete Custom Field",
      description: "Delete a custom field definition",
      inputSchema: {
        field_id: z.string().describe("ID of the custom field to delete"),
      },
  • Registration: contactTools (which includes delete_custom_field) is spread into the allTools export object.
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
    };
  • src/index.ts:20-23 (registration)
    Registration: All tools including delete_custom_field are registered with the MCP server via registerTool.
    // Register all tools
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
  • Helper function makeRequest used by the handler to make HTTP requests to the SendGrid API.
    export async function makeRequest(url: string, options: RequestInit = {}): Promise<any> {
      const response = await fetch(url, {
        headers: {
          ...getAuthHeaders(),
          ...options.headers,
        },
        ...options,
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`SendGrid API error (${response.status}): ${errorText}`);
      }
    
      return response.json();
    }
Behavior2/5

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

No annotations provided. The description only says 'delete' but does not disclose if the action is irreversible, dependencies, or required permissions. Minimal behavioral transparency.

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

Conciseness4/5

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

Very concise single sentence with no wasted words. However, it may be too sparse for a delete operation that could benefit from a warning about irreversibility.

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?

Missing contextual details like irreversibility, side effects, or return behavior. For a simple tool, it could be more complete.

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 coverage is 100% for one parameter. The description adds no extra meaning beyond what the schema provides (ID of the custom field to delete). Baseline 3 is appropriate.

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 it deletes a custom field definition. However, it does not differentiate from other delete tools like delete_contact or delete_template, but the purpose is specific.

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?

No guidance on when to use this tool, prerequisites, or alternatives. The description only states what it does, not the context of use.

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