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
| 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 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.` }] }; },
- src/tools/templates.ts:89-95 (schema)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"), }, },
- src/tools/index.ts:16-16 (registration)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); }