Skip to main content
Glama
samihalawa

SMTP MCP Server

update-email-template

Modify existing email templates in the SMTP MCP Server by updating subject, body, name, or default status to maintain consistent communication.

Instructions

Update an existing email template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the template to update
nameNoName of the template
subjectNoEmail subject template
bodyNoEmail body template
isDefaultNoWhether this template should be the default

Implementation Reference

  • The core handler function that implements the update-email-template tool logic. It retrieves email templates, finds the one by ID, applies updates to name, subject, body, and isDefault flag (handling default conflicts), then saves the updated template.
    /**
     * Handle update-email-template tool call
     */
    async function handleUpdateEmailTemplate(parameters: any) {
      try {
        // Get existing templates
        const templates = await getEmailTemplates();
        
        // Find the template to update
        const template = templates.find(t => t.id === parameters.id);
        
        if (!template) {
          return {
            success: false,
            message: `Email template with ID ${parameters.id} not found`
          };
        }
        
        // Update the template
        const updatedTemplate = { ...template };
        
        if (parameters.name !== undefined) updatedTemplate.name = parameters.name;
        if (parameters.subject !== undefined) updatedTemplate.subject = parameters.subject;
        if (parameters.body !== undefined) updatedTemplate.body = parameters.body;
        
        // Handle default flag
        if (parameters.isDefault !== undefined && parameters.isDefault !== template.isDefault) {
          updatedTemplate.isDefault = parameters.isDefault;
          
          // If setting as default, update other templates
          if (updatedTemplate.isDefault) {
            templates.forEach(t => {
              if (t.id !== parameters.id && t.isDefault) {
                t.isDefault = false;
                saveEmailTemplate(t).catch(err => {
                  logToFile('Error updating template:');
                  logToFile(err instanceof Error ? err.message : 'Unknown error');
                });
              }
            });
          }
        }
        
        // Save the updated template
        await saveEmailTemplate(updatedTemplate);
        
        return {
          success: true,
          template: updatedTemplate
        };
      } catch (error) {
        logToFile('Error in handleUpdateEmailTemplate:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
    }
  • Defines the tool's metadata (name, description) and input schema for validation, specifying required 'id' and optional fields for updating the template.
    "update-email-template": {
      name: "update-email-template",
      description: "Update an existing email template",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "ID of the template to update"
          },
          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: ["id"]
      }
    },
  • Registers the tool handler dispatch within the MCP tool call request handler switch statement.
    case "update-email-template":
      return await handleUpdateEmailTemplate(toolParams);
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Update' implies a mutation, it doesn't specify permission requirements, whether changes are reversible, rate limits, or what happens to unspecified fields (partial vs. full updates). This leaves significant behavioral gaps for a mutation tool.

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 front-loaded with the core purpose and appropriately sized for what it communicates.

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?

For a mutation tool with 5 parameters, no annotations, and no output schema, the description is insufficient. It lacks behavioral context (permissions, side effects), usage guidance, and any information about return values or error conditions, leaving the agent with significant gaps.

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 all parameters are documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema (e.g., no examples, format details, or constraints). This meets the baseline for high schema coverage.

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 action ('Update') and resource ('an existing email template'), making the purpose immediately understandable. It distinguishes from 'add-email-template' by specifying 'existing', but doesn't differentiate from other update operations like 'update-smtp-config' beyond the resource type.

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 'add-email-template' or 'delete-email-template'. It doesn't mention prerequisites (e.g., needing an existing template ID) or contextual factors that might influence tool selection.

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