Skip to main content
Glama
deyikong

SendGrid MCP Server

by deyikong

List All Templates

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,
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the retrieval action but lacks details on permissions, rate limits, pagination (beyond the 'page_size' parameter), or response format. For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It front-loads the core purpose ('Retrieve all transactional templates') and adds clarifying detail ('legacy and dynamic') without unnecessary elaboration. Every word earns its place.

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

Completeness3/5

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

For a read-only list tool with no annotations and no output schema, the description is minimally adequate. It covers the resource type and scope but lacks details on behavioral traits like pagination, permissions, or response structure. Given the simplicity (2 parameters, 100% schema coverage), it's complete enough for basic use but could be improved with more context.

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 both parameters ('generations' and 'page_size'). The description adds no additional parameter semantics beyond what the schema provides, such as default values or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('Retrieve') and resource ('all transactional templates'), specifying both legacy and dynamic types. It distinguishes the tool's scope from sibling tools like 'get_template' (singular) and 'create_template' (write operation), though it doesn't explicitly contrast with other list tools like 'list_contacts' or 'list_senders'.

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 guidance is provided on when to use this tool versus alternatives. The description doesn't mention prerequisites, such as authentication or permissions, or differentiate it from similar list operations like 'list_contacts' or 'list_senders' in the sibling set. Usage is implied by the tool name but not explicitly stated.

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