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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | New name for the template | |
| template_id | Yes | ID of the template to update |
Implementation Reference
- src/tools/templates.ts:74-85 (handler)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) }] }; },
- src/tools/templates.ts:66-73 (schema)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"), }, },
- src/tools/index.ts:7-16 (registration)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); }