Skip to main content
Glama
railsware

Mailtrap Email Sending

by railsware

list-templates

Read-only

Retrieve all email templates from the Mailtrap Email Sending platform to manage and reuse transactional email designs.

Instructions

List all email templates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that lists email templates from the Mailtrap API, formats them, and returns as content blocks, handling errors appropriately.
    import { client } from "../../client";
    
    async function listTemplates(): Promise<{ content: any[]; isError?: boolean }> {
      try {
        if (!client) {
          throw new Error("MAILTRAP_API_TOKEN environment variable is required");
        }
    
        const templates = await client.templates.getList();
    
        if (!templates || templates.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: "No templates found in your Mailtrap account.",
              },
            ],
          };
        }
    
        const templateList = templates
          .map(
            (template) =>
              `• ${template.name} (ID: ${template.id}, UUID: ${template.uuid})\n  Subject: ${template.subject}\n  Category: ${template.category}\n  Created: ${template.created_at}\n`
          )
          .join("\n");
    
        return {
          content: [
            {
              type: "text",
              text: `Found ${templates.length} template(s):\n\n${templateList}`,
            },
          ],
        };
      } catch (error) {
        console.error("Error listing templates:", error);
    
        const errorMessage = error instanceof Error ? error.message : String(error);
    
        return {
          content: [
            {
              type: "text",
              text: `Failed to list templates: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
    
    export default listTemplates;
  • The input schema for the list-templates tool, defining an empty object (no parameters required).
    const listTemplatesSchema = {
      type: "object",
      properties: {},
      additionalProperties: false,
    };
    
    export default listTemplatesSchema;
  • src/server.ts:55-63 (registration)
    Registration of the 'list-templates' tool, specifying name, description, input schema, handler function, and read-only annotation.
    {
      name: "list-templates",
      description: "List all email templates",
      inputSchema: listTemplatesSchema,
      handler: listTemplates,
      annotations: {
        readOnlyHint: true,
      },
    },
Behavior3/5

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

The description adds minimal behavioral context beyond the readOnlyHint annotation. It doesn't specify whether this returns a paginated list, the format of returned templates, or any rate limits. However, it doesn't contradict the annotation (which correctly indicates a read-only operation).

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 wasted words. It's appropriately sized for a simple list operation and front-loads the core purpose immediately.

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 simple read-only list tool with no parameters and no output schema, the description is minimally adequate. However, it lacks details about the return format (e.g., structured list vs. raw data) and doesn't leverage the sibling context to clarify its role in the template management workflow.

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

Parameters4/5

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

With 0 parameters and 100% schema description coverage, the description appropriately doesn't need to explain parameters. The baseline for this scenario is 4 since there are no parameters to document.

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 ('List') and resource ('all email templates'), making the purpose unambiguous. However, it doesn't differentiate from potential sibling tools like 'get-sandbox-messages' or explain what distinguishes listing templates from other template operations.

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?

The description provides no guidance on when to use this tool versus alternatives like 'create-template', 'update-template', or 'delete-template'. It doesn't mention prerequisites, context for listing templates, or any exclusions.

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/railsware/mailtrap-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server