Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

delete_template

Remove a template and all its versions from your SendGrid account to manage your email templates effectively.

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 performs the actual deletion: checks read-only mode, then sends DELETE request to SendGrid templates API endpoint.
    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 validating the 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"), }, },
  • Complete definition of the delete_template tool object within exported templateTools.
    delete_template: { config: { title: "Delete Template", description: "Delete a template and all its versions", inputSchema: { template_id: z.string().describe("ID of the template to delete"), }, }, 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.` }] }; }, },
  • src/index.ts:21-23 (registration)
    MCP server registration loop that registers delete_template (via allTools) by calling server.registerTool with its config and handler.
    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