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
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | Yes | ID of the template to delete |
Implementation Reference
- src/tools/templates.ts:96-106 (handler)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.` }] }; },
- src/tools/templates.ts:89-95 (schema)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"), }, },
- src/tools/templates.ts:88-107 (registration)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); }