Update Email List
update_email_listModify an existing email list's properties like name to maintain accurate contact segmentation for targeted email campaigns.
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)The handler function executes the tool logic: checks read-only mode, performs a PATCH request to the SendGrid API to update the email list's name, and returns the JSON result.
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:44-51 (schema)The tool configuration including title, description, and Zod inputSchema for parameters list_id and name.
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/index.ts:21-23 (registration)Generic registration loop that registers all tools from allTools, including update_email_list, to the MCP server.
for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); } - src/tools/index.ts:9-16 (registration)Aggregation of all tool objects into allTools, including contactTools which contains update_email_list.
export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools,