Update Custom Field
update_custom_fieldUpdate the name of an existing custom field by providing its field ID and new name.
Instructions
Update an existing custom field definition
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field_id | Yes | ID of the custom field to update | |
| name | Yes | New name for the custom field |
Implementation Reference
- src/tools/contacts.ts:211-231 (handler)The update_custom_field tool definition with its config (title, description, inputSchema with field_id and name) and handler that calls PUT on field_definitions/{field_id} with the new name.
update_custom_field: { config: { title: "Update Custom Field", description: "Update an existing custom field definition", inputSchema: { field_id: z.string().describe("ID of the custom field to update"), name: z.string().describe("New name for the custom field"), }, }, handler: async ({ field_id, name }: { field_id: string; name: 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: "PUT", body: JSON.stringify({ name }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, - src/tools/contacts.ts:212-219 (schema)Input schema for update_custom_field validating field_id (string) and name (string) using Zod.
config: { title: "Update Custom Field", description: "Update an existing custom field definition", inputSchema: { field_id: z.string().describe("ID of the custom field to update"), name: z.string().describe("New name for the custom field"), }, }, - src/index.ts:20-22 (registration)Tools are registered dynamically by iterating over allTools. update_custom_field is registered as a tool because it's part of contactTools which is spread into allTools.
// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); - src/tools/index.ts:3-12 (registration)contactTools (which contains update_custom_field) is spread into allTools, making it available for registration.
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,