Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

update_contact

Modify existing contact details in SendGrid, including email, name, phone, address, and custom fields to maintain accurate recipient information.

Instructions

Update existing contact information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactsYesArray of contact objects with updates

Implementation Reference

  • The async handler function for the "update_contact" tool. Checks read-only mode and sends a PUT request to the SendGrid Marketing Contacts API to update the specified contacts.
    handler: async ({ contacts }: { contacts: any[] }): 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/contacts", { method: "PUT", body: JSON.stringify({ contacts }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Tool configuration including title, description, and Zod inputSchema defining the structure for contacts to update (requires id, optional fields for email, names, address, custom_fields).
    config: { title: "Update Contact", description: "Update existing contact information", inputSchema: { contacts: z.array( z.object({ id: z.string().describe("Contact ID (required for updates)"), email: z.string().email().optional().describe("Email address"), first_name: z.string().optional().describe("First name"), last_name: z.string().optional().describe("Last name"), phone_number: z.string().optional().describe("Phone number"), address_line_1: z.string().optional().describe("Address line 1"), address_line_2: z.string().optional().describe("Address line 2"), city: z.string().optional().describe("City"), state_province_region: z.string().optional().describe("State/Province/Region"), postal_code: z.string().optional().describe("Postal code"), country: z.string().optional().describe("Country"), custom_fields: z.record(z.any()).optional().describe("Custom field values"), }) ).describe("Array of contact objects with updates"), }, },
  • src/index.ts:21-23 (registration)
    MCP server registration loop that dynamically registers the "update_contact" tool (via allTools) using server.registerTool with its config and handler.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Aggregation of all tool sets into allTools, including contactTools which contains the "update_contact" tool definition.
    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