update_contact
Modify existing contact details in SendGrid, including email, name, address, phone, and custom fields to maintain accurate subscriber information.
Instructions
Update existing contact information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contacts | Yes | Array of contact objects with updates |
Implementation Reference
- src/tools/contacts.ts:388-399 (handler)Handler function for update_contact tool. Checks read-only mode, then sends a PUT request to SendGrid's /marketing/contacts endpoint with the updated contacts array.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) }] }; },
- src/tools/contacts.ts:369-386 (schema)Zod input schema for update_contact tool, defining the structure of contacts array with optional fields for updating 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/tools/contacts.ts:365-400 (registration)Definition and registration of the update_contact tool within the contactTools object.update_contact: { 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"), }, }, 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) }] }; }, },
- src/tools/index.ts:9-16 (registration)Registration of contactTools (including update_contact) into the allTools object exported for use in MCP.export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools,