Skip to main content
Glama
samihalawa

SMTP MCP Server

get-email-templates

Retrieve all available email templates from the SMTP MCP Server for use in automated email campaigns with variable substitution.

Instructions

Get all email templates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'get-email-templates' tool. It retrieves all email templates using getEmailTemplates() from config.ts and returns them wrapped in a success response object.
    async function handleGetEmailTemplates() {
      try {
        const templates = await getEmailTemplates();
        
        return {
          success: true,
          templates: templates
        };
      } catch (error) {
        logToFile('Error in handleGetEmailTemplates:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
  • The tool schema definition for 'get-email-templates', including name, description, and empty input schema (no parameters required).
    "get-email-templates": {
      name: "get-email-templates",
      description: "Get all email templates",
      inputSchema: {
        type: "object",
        properties: {},
        required: []
      }
  • Switch case in the CallToolRequestSchema handler that dispatches 'get-email-templates' tool calls to the handleGetEmailTemplates function.
    case "get-email-templates":
      return await handleGetEmailTemplates();
  • src/index.ts:59-62 (registration)
    Creates the tool definitions object (including 'get-email-templates') using createToolDefinitions() and passes it to setupRequestHandlers for server registration.
    const TOOLS = createToolDefinitions();
    
    // Setup request handlers
    await setupRequestHandlers(server, TOOLS);
  • Helper function getEmailTemplates() that reads all JSON template files from the templates directory and returns the list of EmailTemplate objects. Called by the tool handler.
    export async function getEmailTemplates(): Promise<EmailTemplate[]> {
      try {
        const files = await fs.readdir(TEMPLATES_DIR);
        const templates: EmailTemplate[] = [];
        
        for (const file of files) {
          if (file.endsWith('.json')) {
            const templatePath = path.join(TEMPLATES_DIR, file);
            const template = await fs.readJson(templatePath) as EmailTemplate;
            templates.push(template);
          }
        }
        
        return templates;
      } catch (error) {
        logToFile('Error reading email templates:');
        return [DEFAULT_TEMPLATE, BUSINESS_TEMPLATE, NEWSLETTER_TEMPLATE];
      }
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. 'Get all email templates' implies a read-only operation but doesn't disclose behavioral traits like authentication requirements, rate limits, pagination, sorting, or what 'all' means in practice (e.g., all accessible templates, all system-wide templates). It lacks context about what the tool actually does beyond the basic verb.

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 extremely concise with just three words, front-loaded with the action and resource. There's zero wasted language, and every word earns its place by specifying what is being retrieved.

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 no annotations, no output schema, and a read operation with potential complexity (e.g., what 'all' includes, return format), the description is incomplete. It doesn't explain what is returned, how templates are structured, or any behavioral constraints. For a tool with siblings that handle similar resources, more context is needed to distinguish usage.

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?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter information, and 'Get all email templates' appropriately implies no filtering parameters are required. Baseline for 0 parameters is 4.

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

Purpose3/5

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

The description 'Get all email templates' clearly states the action (get) and resource (email templates), but it's vague about scope and doesn't differentiate from sibling tools like 'get-email-logs' or 'get-smtp-configs'. It specifies 'all' which provides some scope information, but lacks detail about what 'all' encompasses.

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. With siblings like 'get-email-logs' and 'get-smtp-configs' that retrieve different resources, and 'update-email-template' that modifies templates, the description offers no context about appropriate use cases or 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/samihalawa/mcp-server-smtp'

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