get_template_version
Retrieve specific template version details from SendGrid to access email template content, structure, and configuration for email marketing and transactional campaigns.
Instructions
Retrieve details of a specific template version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | Yes | ID of the template | |
| version_id | Yes | ID of the version to retrieve |
Implementation Reference
- src/tools/templates.ts:191-194 (handler)The async handler function that executes the tool logic by making a GET request to the SendGrid API to retrieve details of a specific template version.handler: async ({ template_id, version_id }: { template_id: string; version_id: string }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/templates/${template_id}/versions/${version_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
- src/tools/templates.ts:186-189 (schema)Zod input schema defining the required parameters: template_id and version_id.inputSchema: { template_id: z.string().describe("ID of the template"), version_id: z.string().describe("ID of the version to retrieve"), },
- src/tools/templates.ts:182-195 (registration)The tool definition and registration within the templateTools object, including config (with schema) and handler.get_template_version: { config: { title: "Get Template Version", description: "Retrieve details of a specific template version", inputSchema: { template_id: z.string().describe("ID of the template"), version_id: z.string().describe("ID of the version to retrieve"), }, }, handler: async ({ template_id, version_id }: { template_id: string; version_id: string }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/templates/${template_id}/versions/${version_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, },
- src/tools/index.ts:7-16 (registration)Import of templateTools and inclusion into allTools object, which is then registered in MCP server.import { templateTools } from "./templates.js"; export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools,
- src/index.ts:20-23 (registration)MCP server registration loop that registers all tools from allTools, including get_template_version.// Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }