Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

delete_template_version

Remove a specific version of an email template from SendGrid by providing the template ID and version ID to manage template revisions.

Instructions

Delete a specific version of a template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesID of the template
version_idYesID of the version to delete

Implementation Reference

  • The main handler function that checks read-only mode and sends a DELETE request to the SendGrid API to delete the specified template version.
    handler: async ({ template_id, version_id }: { template_id: string; version_id: 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}/versions/${version_id}`, {
        method: "DELETE",
      });
      return { content: [{ type: "text", text: `Template version ${version_id} deleted successfully.` }] };
    },
  • Zod input schema defining the required template_id and version_id parameters.
    inputSchema: {
      template_id: z.string().describe("ID of the template"),
      version_id: z.string().describe("ID of the version to delete"),
    },
  • The tool definition object added to templateTools export, which registers the tool.
    delete_template_version: {
      config: {
        title: "Delete Template Version",
        description: "Delete a specific version of a template",
        inputSchema: {
          template_id: z.string().describe("ID of the template"),
          version_id: z.string().describe("ID of the version to delete"),
        },
      },
      handler: async ({ template_id, version_id }: { template_id: string; version_id: 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}/versions/${version_id}`, {
          method: "DELETE",
        });
        return { content: [{ type: "text", text: `Template version ${version_id} deleted successfully.` }] };
      },
    },
  • Import of templateTools and inclusion via spread operator into allTools, the central tools registry.
    import { templateTools } from "./templates.js";
    
    export const allTools = {
      ...automationTools,
      ...campaignTools,
      ...contactTools,
      ...mailTools,
      ...miscTools,
      ...statsTools,
      ...templateTools,
    };

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