Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

delete_custom_field

Remove custom field definitions from your SendGrid contact database to maintain clean data structure and eliminate unused 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 that implements the core logic for the 'delete_custom_field' tool. It checks if read-only mode is active, and if not, sends a DELETE request to the SendGrid API to remove the custom field definition specified by field_id.
    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.` }] }; },
  • Zod schema defining the input parameter 'field_id' as a required string for the delete_custom_field tool.
    inputSchema: { field_id: z.string().describe("ID of the custom field to delete"), },
  • Local registration of the 'delete_custom_field' tool within the contactTools object, including title, description, input schema, and handler.
    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.` }] }; }, },
  • Top-level registration where contactTools (containing delete_custom_field) is spread into the allTools export for use in the MCP protocol.
    export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };

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