Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

Update Template

update_template

Update the name of an existing email template using its ID. Provide the template ID and new name to apply changes.

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 for update_template tool. It checks read-only mode, then sends a PATCH request to SendGrid's 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) }] };
    },
  • Input schema for update_template: defines template_id (required string) and name (required string) as Zod-validated inputs.
    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 update_template tool is registered as a property of the exported 'templateTools' object.
    export const templateTools = {
  • templateTools (including update_template) are imported and spread into the allTools export, which is used by the MCP server registration.
    import { templateTools } from "./templates.js";
    
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
  • The checkReadOnlyMode helper used by the handler to block writes when READ_ONLY is set.
    export function checkReadOnlyMode(): { blocked: boolean; message?: string } {
      const env = getEnv();
      if (env.READ_ONLY) {
        return {
          blocked: true,
          message: "❌ Operation blocked: Server is running in READ_ONLY mode. Set READ_ONLY=false in your environment to enable write operations."
        };
      }
      return { blocked: false };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must disclose behavioral traits. It only states the purpose without detailing idempotency, permissions, side effects, or error behavior. For a mutation tool, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with one sentence that directly states the purpose. No unnecessary words, but it could include a brief note on expected return value without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple with two parameters and no output schema. The description covers the basic action but omits return value expectations and error handling, leaving the agent with incomplete usage context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% and parameter descriptions are adequate. The description adds no additional meaning beyond the schema, which already explains the parameters. Baseline score applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'update' and the resource 'existing template name', distinguishing it from sibling tools like create_template (creation) and delete_template (deletion).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use when renaming a template but does not provide when-not-to-use or alternatives. No prerequisites or exclusion criteria are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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