Skip to main content
Glama
samihalawa

SMTP MCP Server

add-email-template

Create reusable email templates with customizable subject and body content for automated email sending through SMTP MCP Server.

Instructions

Add a new email template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the template
subjectYesEmail subject template
bodyYesEmail body template
isDefaultNoWhether this template should be the default

Implementation Reference

  • The core handler function that implements the add-email-template tool logic. It retrieves existing templates, creates a new EmailTemplate with a generated UUID, handles the isDefault flag by unsetting it on other default templates, saves the new template, and returns success with the new template details or error information.
    async function handleAddEmailTemplate(parameters: any) {
      try {
        // Get existing templates
        const templates = await getEmailTemplates();
        
        // Create a new template
        const newTemplate: EmailTemplate = {
          id: generateUUID(),
          name: parameters.name,
          subject: parameters.subject,
          body: parameters.body,
          isDefault: parameters.isDefault ?? false
        };
        
        // If this is set as default, we'll need to update other templates
        if (newTemplate.isDefault) {
          templates.forEach(template => {
            if (template.isDefault) {
              template.isDefault = false;
              saveEmailTemplate(template).catch(err => {
                logToFile('Error updating template:');
                logToFile(err instanceof Error ? err.message : 'Unknown error');
              });
            }
          });
        }
        
        // Save the new template
        await saveEmailTemplate(newTemplate);
        
        return {
          success: true,
          template: newTemplate
        };
      } catch (error) {
        logToFile('Error in handleAddEmailTemplate:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
    }
  • Tool definition including name, description, and input schema specifying required parameters: name, subject, body; optional: isDefault.
    "add-email-template": {
      name: "add-email-template",
      description: "Add a new email template",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of the template"
          },
          subject: {
            type: "string",
            description: "Email subject template"
          },
          body: {
            type: "string",
            description: "Email body template"
          },
          isDefault: {
            type: "boolean",
            description: "Whether this template should be the default"
          }
        },
        required: ["name", "subject", "body"]
      }
    },
  • The switch case in the CallToolRequestSchema handler that routes 'add-email-template' tool calls to the handleAddEmailTemplate function.
    case "add-email-template":
      return await handleAddEmailTemplate(toolParams);
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 states 'Add a new email template', implying a write operation, but does not cover permissions, side effects, error handling, or response format. This is inadequate for a mutation tool with zero annotation coverage, leaving key behavioral traits unspecified.

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: 'Add a new email template'. It is front-loaded with the core purpose, has no redundant words, and every part earns its place, making it highly concise and well-structured.

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 complexity of a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral aspects like permissions, side effects, and return values, and does not compensate for the absence of structured data, making it incomplete for effective tool selection and invocation.

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?

The input schema has 100% description coverage, documenting all four parameters (name, subject, body, isDefault) clearly. The description adds no additional semantic context beyond what the schema provides, such as formatting examples or constraints, so it meets the baseline for high schema coverage without compensating value.

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 'Add a new email template' clearly states the action (add) and resource (email template), which is specific and unambiguous. However, it does not differentiate from sibling tools like 'update-email-template' or explain what constitutes a new template versus an update, leaving room for improvement in distinguishing from alternatives.

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 such as 'update-email-template' or 'get-email-templates'. It lacks context on prerequisites, when-not-to-use scenarios, or comparisons with sibling tools, offering minimal usage direction.

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