update_custom_field
Modify an existing custom field definition in SendGrid by updating its name using the field ID, allowing you to maintain organized contact data structures.
Instructions
Update an existing custom field definition
Input Schema
TableJSON 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:220-231 (handler)The handler function that implements the core logic of the update_custom_field tool by sending a PUT request to the SendGrid API to update the name of an existing 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:215-218 (schema)Zod input schema defining the parameters for the tool: field_id (string) and name (string).inputSchema: { field_id: z.string().describe("ID of the custom field to update"), name: z.string().describe("New name for the custom field"), },
- src/tools/contacts.ts:211-232 (registration)The update_custom_field tool is registered as a property in the exported contactTools object, which is later spread into the main allTools registry.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) }] }; }, },