get_template
Retrieve specific email template details and all versions for SendGrid email campaigns and automation workflows.
Instructions
Retrieve details of a specific template including all versions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| template_id | Yes | ID of the template to retrieve |
Implementation Reference
- src/tools/templates.ts:33-37 (handler)The handler function for the 'get_template' tool. It takes a template_id parameter and fetches the template details from the SendGrid API, returning the result as formatted JSON.handler: async ({ template_id }: { template_id: string }): Promise<ToolResult> => { const result = await makeRequest(`https://api.sendgrid.com/v3/templates/${template_id}`); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; }, },
- src/tools/templates.ts:26-32 (schema)The configuration object for the 'get_template' tool, including title, description, and Zod input schema defining the required 'template_id' string parameter.config: { title: "Get Template Details", description: "Retrieve details of a specific template including all versions", inputSchema: { template_id: z.string().describe("ID of the template to retrieve"), }, },
- src/tools/index.ts:9-17 (registration)Registration of all tools by spreading individual tool objects, including templateTools which contains the 'get_template' tool.export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };
- src/index.ts:21-23 (registration)Final MCP server registration loop that registers every tool from the allTools object, including 'get_template', using server.registerTool.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }