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
| Name | Required | Description | Default |
|---|---|---|---|
| field_id | Yes | ID of the custom field to delete |
Implementation Reference
- src/tools/contacts.ts:242-252 (handler)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.` }] }; },
- src/tools/contacts.ts:238-240 (schema)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"), },
- src/tools/contacts.ts:234-253 (registration)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.` }] }; }, },
- src/tools/index.ts:9-17 (registration)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, };