Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

delete_custom_field

Remove a custom field definition from SendGrid contact management by specifying its ID to clean up unused data fields.

Instructions

Delete a custom field definition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
field_idYesID of the custom field to delete

Implementation Reference

  • The handler function for the 'delete_custom_field' tool. It checks read-only mode and sends a DELETE request to the SendGrid API to delete the custom field.
    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 using Zod for the delete_custom_field tool, defining the required field_id parameter.
    inputSchema: {
      field_id: z.string().describe("ID of the custom field to delete"),
    },
  • Tool registration within contactTools object, defining config (including schema) and handler for delete_custom_field.
    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.` }] };
      },
    },

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