Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

update_template

Modify the name of an existing email template to better organize and identify your email campaigns and communications.

Instructions

Update the name of an existing template

Input Schema

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

Implementation Reference

  • The async handler function that checks read-only mode and performs 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) }] }; },
  • The tool configuration including title, description, and Zod input schema defining 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"), }, },
  • Import of templateTools from templates.ts and spreading it into the allTools export, registering update_template among other template tools.
    import { templateTools } from "./templates.js"; export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools,
  • src/index.ts:5-23 (registration)
    Top-level registration loop that registers all tools from allTools with the MCP server, including update_template.
    import { allTools } from "./tools/index.js"; import { allResources } from "./resources/index.js"; import { allPrompts } from "./prompts/index.js"; import { validateEnvironment, getSafeEnvInfo } from "./shared/env.js"; const server = new McpServer({ name: "sendgrid-mcp", version: "1.0.0", }); // Register all resources for (const [uri, resource] of Object.entries(allResources)) { server.registerResource(uri, uri, resource.config, resource.handler); } // Register all tools 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