Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

update_template

Modify the name of an existing email template in SendGrid to reflect content changes or organizational updates.

Instructions

Update the name of an existing template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesID of the template to update
nameYesNew name for the template

Implementation Reference

  • The handler function that checks for read-only mode and sends a PATCH request to the SendGrid API to update the template name.
    handler: async ({ template_id, name }: { template_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/templates/${template_id}`, { method: "PATCH", body: JSON.stringify({ name }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Tool configuration including title, description, and Zod input schema defining the required parameters: template_id and name.
    config: { title: "Update Template", description: "Update the name of an existing template", inputSchema: { template_id: z.string().describe("ID of the template to update"), name: z.string().describe("New name for the template"), }, },
  • The complete tool definition and registration within the exported templateTools object.
    update_template: { config: { title: "Update Template", description: "Update the name of an existing template", inputSchema: { template_id: z.string().describe("ID of the template to update"), name: z.string().describe("New name for the template"), }, }, handler: async ({ template_id, name }: { template_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/templates/${template_id}`, { method: "PATCH", body: JSON.stringify({ name }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, },
  • Import of templateTools and spreading into the allTools export, aggregating all tools for higher-level registration.
    import { templateTools } from "./templates.js"; export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };
  • src/index.ts:21-23 (registration)
    Loop that registers every tool from allTools with the MCP server using registerTool.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }

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