Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

create_template

Create dynamic transactional email templates for automated email campaigns and personalized communications using SendGrid's API.

Instructions

Create a new dynamic transactional template

Input Schema

NameRequiredDescriptionDefault
generationNoTemplate generation typedynamic
nameYesName of the template

Input Schema (JSON Schema)

{ "properties": { "generation": { "default": "dynamic", "description": "Template generation type", "enum": [ "legacy", "dynamic" ], "type": "string" }, "name": { "description": "Name of the template", "type": "string" } }, "required": [ "name" ], "type": "object" }

Implementation Reference

  • The handler function that implements the core logic for creating a new SendGrid dynamic template via API POST request, including read-only mode check.
    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) }] }; },
  • Tool configuration including title, description, and Zod input schema for validating 'name' and optional 'generation' parameters.
    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:20-23 (registration)
    Registers all tools from allTools (which includes create_template) with the MCP server using registerTool.
    // Register all tools for (const [name, tool] of Object.entries(allTools)) { server.registerTool(name, tool.config as any, tool.handler as any); }
  • Combines all tool objects including templateTools (containing create_template) into allTools export for top-level registration.
    export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...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