Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

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
NameRequiredDescriptionDefault
template_idYesID of the template to retrieve

Implementation Reference

  • 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) }] }; }, },
  • 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"), }, },
  • 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); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deyikong/sendgrid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server