Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

list_templates

Retrieve all transactional email templates (legacy and dynamic) from SendGrid for managing email campaigns and automation workflows.

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 implements the core logic of the list_templates tool. It constructs the SendGrid API endpoint URL with optional parameters for filtering by template generation and pagination, fetches the data, and returns the result as formatted JSON.
    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) }] }; },
  • The tool configuration object defining the title, description, and Zod-based input schema for validating parameters 'generations' (optional string filter) and 'page_size' (optional number, default 50).
    config: { title: "List All Templates", description: "Retrieve all transactional templates (legacy and dynamic)", 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)"), }, },
  • Registration of the templateTools (including list_templates) by importing from templates.ts and spreading into the central allTools export, which serves as the MCP tools registry.
    import { templateTools } from "./templates.js"; 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