Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_templates

Retrieve all transactional email templates (legacy and dynamic) from SendGrid to manage and organize your email marketing campaigns and automated communications.

Instructions

Retrieve all transactional templates (legacy and dynamic)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
generationsNoFilter by template generation (legacy or dynamic)
page_sizeNoNumber of templates to return (max 200)

Implementation Reference

  • The handler function that executes the list_templates tool, fetching templates from SendGrid API with optional filters.
    handler: async ({ generations, page_size }: { generations?: string; page_size?: number }): Promise<ToolResult> => { let url = `https://api.sendgrid.com/v3/templates?page_size=${page_size || 50}`; if (generations) url += `&generations=${generations}`; const result = await makeRequest(url); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; },
  • Zod schema for input validation of the list_templates tool parameters.
    inputSchema: { generations: z.string().optional().describe("Filter by template generation (legacy or dynamic)"), page_size: z.number().optional().default(50).describe("Number of templates to return (max 200)"), },
  • Includes templateTools (containing list_templates) into the allTools export.
    export const allTools = { ...automationTools, ...campaignTools, ...contactTools, ...mailTools, ...miscTools, ...statsTools, ...templateTools, };
  • src/index.ts:21-23 (registration)
    Registers all tools from allTools with the MCP server, including list_templates.
    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