Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

delete_template

Remove a template and all its versions from SendGrid to clean up unused email designs and maintain organized templates.

Instructions

Delete a template and all its versions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesID of the template to delete

Implementation Reference

  • The handler function that implements the core logic of deleting a template via SendGrid API, including read-only mode check.
    handler: async ({ template_id }: { template_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}`, {
        method: "DELETE",
      });
      return { content: [{ type: "text", text: `Template ${template_id} deleted successfully.` }] };
    },
  • Tool configuration with title, description, and Zod input schema defining the required 'template_id' parameter.
    config: {
      title: "Delete Template",
      description: "Delete a template and all its versions",
      inputSchema: {
        template_id: z.string().describe("ID of the template to delete"),
      },
    },
  • Includes templateTools (containing delete_template) in the allTools object by spreading it.
    ...templateTools,
  • src/index.ts:21-23 (registration)
    Registers all tools from allTools, including 'delete_template', with the MCP server instance.
    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