Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

List All Templates

list_templates

List all transactional templates from SendGrid, filtering by legacy or dynamic generation and setting page size up to 200.

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 for 'list_templates' that calls SendGrid API v3/templates with optional generations and page_size filters, returning the result as JSON text.
    export const templateTools = {
      list_templates: {
        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)"),
          },
        },
        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 inputSchema for list_templates defines optional 'generations' (string) and 'page_size' (number, default 50) parameters using Zod.
    export const templateTools = {
      list_templates: {
        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)"),
          },
        },
        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) }] };
        },
      },
  • src/tools/index.ts:7-7 (registration)
    Import of templateTools from templates.ts into the central allTools export
    import { templateTools } from "./templates.js";
  • Spread of templateTools into allTools, making list_templates available for registration
    ...templateTools,
  • src/index.ts:21-23 (registration)
    The MCP server registration loop that calls server.registerTool for each tool including list_templates
    for (const [name, tool] of Object.entries(allTools)) {
      server.registerTool(name, tool.config as any, tool.handler as any);
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden but only states the basic retrieval action. It fails to disclose that the tool is read-only, that results are paginated (max 200), or that the 'all' scope is limited to the authenticated account. No behavioral warnings or limitations are conveyed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence that efficiently conveys the core function. However, it could be slightly more informative without losing brevity, e.g., noting it returns a paginated list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema, the description should indicate what information is returned for each template (e.g., id, name, generation). It also fails to mention that the tool lists only the user's own templates, which is important for context. With many sibling tools, it does not help the agent decide between similar list tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the two parameters. The tool description adds no additional meaning or context about how parameters interact or default behaviors (e.g., page_size default 50), meeting the baseline expectation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves all transactional templates, explicitly mentioning both legacy and dynamic categories. This differentiates it from sibling tools like get_template (single template) and list_single_sends.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No usage guidelines are provided. The description does not indicate when to use this tool versus alternatives (e.g., get_template for a specific template), nor does it mention any prerequisites or best practices for filtering or pagination.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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