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
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | Yes | ID of the template | |
| version_id | Yes | ID of the version to delete |
Implementation Reference
- src/tools/templates.ts:278-288 (handler)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.` }] }; },
- src/tools/templates.ts:273-276 (schema)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"), },
- src/tools/templates.ts:269-289 (registration)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.` }] }; }, },
- src/tools/index.ts:7-17 (registration)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, };