Update Email List
update_email_listUpdate an existing email list's name by providing its ID and a new name.
Instructions
Update the properties of an existing email list
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ID of the email list to update | |
| name | Yes | New name for the email list |
Implementation Reference
- src/tools/contacts.ts:52-63 (handler)Handler function that executes the update_email_list logic. Makes a PATCH request to SendGrid's marketing lists API with the list_id and new name.
handler: async ({ list_id, name }: { list_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/lists/${list_id}`, { method: "PATCH", body: JSON.stringify({ name }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, - src/tools/contacts.ts:43-51 (schema)Schema definition for update_email_list: title, description, and inputSchema (list_id and name as required strings).
update_email_list: { config: { title: "Update Email List", description: "Update the properties of an existing email list", inputSchema: { list_id: z.string().describe("ID of the email list to update"), name: z.string().describe("New name for the email list"), }, }, - src/tools/index.ts:9-17 (registration)Registration of contactTools (which includes update_email_list) into the allTools export object.
export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, }; - src/index.ts:20-23 (registration)Tool registration loop that registers all tools (including update_email_list) with the MCP server via server.registerTool().
// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); } - src/tools/contacts.ts:1-4 (helper)Imports used by the update_email_list handler: zod for validation, makeRequest for API calls, ToolResult type, and checkReadOnlyMode for read-only guard.
import { z } from "zod"; import { makeRequest } from "../shared/api.js"; import { ContactSchema, ToolResult } from "../shared/types.js"; import { checkReadOnlyMode } from "../shared/env.js";