Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

update_custom_field

Modify an existing custom field definition in SendGrid to update its name and manage contact data fields for email marketing operations.

Instructions

Update an existing custom field definition

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
field_idYesID of the custom field to update
nameYesNew name for the custom field

Implementation Reference

  • The main handler function for the 'update_custom_field' tool. It checks read-only mode and performs a PUT request to the SendGrid API to update the custom field's name.
    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) }] }; },
  • The configuration object including title, description, and Zod input schema for validating the tool's parameters.
    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"), }, },
  • The tool definition object within contactTools, which registers the 'update_custom_field' tool for export and use.
    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) }] }; }, },
  • Imports contactTools (containing update_custom_field) and spreads it into the allTools object, effectively registering it globally.
    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,

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