get_template
Retrieve template details and versions from SendGrid to manage email content and ensure consistent messaging across campaigns.
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-36 (handler)The handler function executes the tool logic by making an API request to SendGrid to fetch details of the specified template ID and returns the result as formatted JSON text.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 tool configuration including title, description, and Zod input schema for validating the template_id 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/index.ts:21-23 (registration)The MCP server registration loop that registers the get_template tool (along with all others) by calling server.registerTool with its name, config, and handler.for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
- src/tools/index.ts:16-16 (registration)Spreading templateTools into allTools object, which includes the get_template tool definition....templateTools,