Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

create_template

Create dynamic transactional email templates in SendGrid to automate personalized communications and streamline email workflows.

Instructions

Create a new dynamic transactional template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the template
generationNoTemplate generation typedynamic

Implementation Reference

  • The async handler function that implements the core logic of the 'create_template' tool. It performs a read-only mode check, then sends a POST request to the SendGrid API to create a new template with the provided name and optional generation type.
    handler: async ({ name, generation }: { name: string; generation?: 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", { method: "POST", body: JSON.stringify({ name, generation: generation || "dynamic" }), }); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • The tool configuration including title, description, and Zod input schema defining the parameters: required 'name' (string) and optional 'generation' (enum: legacy or dynamic, defaults to dynamic).
    config: { title: "Create New Template", description: "Create a new dynamic transactional template", inputSchema: { name: z.string().describe("Name of the template"), generation: z.enum(["legacy", "dynamic"]).optional().default("dynamic").describe("Template generation type"), }, },
  • src/index.ts:21-23 (registration)
    The MCP server tool registration loop that dynamically registers all tools from the allTools object, including 'create_template' from the templates tools group.
    for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Aggregation of all template tools (including create_template) into the central allTools export via object spread.
    ...templateTools,

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