Skip to main content
Glama
samihalawa

SMTP MCP Server

delete-email-template

Remove an email template from the SMTP MCP Server by specifying its ID to manage your email template collection.

Instructions

Delete an email template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesID of the template to delete

Implementation Reference

  • The primary handler function for the 'delete-email-template' tool. It retrieves all templates, verifies the target template exists, handles reassignment of the default template if necessary, calls the low-level delete function, and returns appropriate success/error responses.
    async function handleDeleteEmailTemplate(parameters: any) {
      try {
        // Get existing templates
        const templates = await getEmailTemplates();
        
        // Find the template to delete
        const template = templates.find(t => t.id === parameters.id);
        
        if (!template) {
          return {
            success: false,
            message: `Email template with ID ${parameters.id} not found`
          };
        }
        
        // If deleting default template, make another one default
        if (template.isDefault && templates.length > 1) {
          const anotherTemplate = templates.find(t => t.id !== parameters.id);
          if (anotherTemplate) {
            anotherTemplate.isDefault = true;
            await saveEmailTemplate(anotherTemplate);
          }
        }
        
        // Delete the template
        await deleteEmailTemplate(parameters.id);
        
        return {
          success: true,
          message: 'Email template deleted successfully'
        };
      } catch (error) {
        logToFile('Error in handleDeleteEmailTemplate:');
        logToFile(error instanceof Error ? error.message : 'Unknown error');
        return {
          success: false,
          message: error instanceof Error ? error.message : 'Unknown error'
        };
      }
    } 
  • Tool definition and input schema for 'delete-email-template', specifying the required 'id' parameter.
    "delete-email-template": {
      name: "delete-email-template",
      description: "Delete an email template",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "ID of the template to delete"
          }
        },
        required: ["id"]
      }
    },
  • Low-level utility function that deletes the specified email template file from the filesystem.
    export async function deleteEmailTemplate(templateId: string): Promise<boolean> {
      try {
        const templatePath = path.join(TEMPLATES_DIR, `${templateId}.json`);
        await fs.remove(templatePath);
        return true;
      } catch (error) {
        logToFile('Error deleting email template:');
        return false;
      }
    }
  • Switch case registration that dispatches 'delete-email-template' tool calls to the handler function.
    case "delete-email-template":
      return await handleDeleteEmailTemplate(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 but only states the action without disclosing behavioral traits. It doesn't mention if deletion is permanent, requires specific permissions, has side effects, or what happens on success/failure. For a destructive operation, this lack of transparency is a significant gap.

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, clear sentence with zero wasted words. It's front-loaded and efficiently communicates the core function without unnecessary elaboration, making it easy to parse quickly.

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 this is a destructive tool with no annotations and no output schema, the description is incomplete. It fails to address critical context like confirmation needs, error handling, or return values, leaving the agent with insufficient information for safe and effective use.

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%, with the single parameter 'id' fully documented in the schema. The description doesn't add any parameter details beyond what the schema provides, so it meets the baseline score of 3 where 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 action ('Delete') and resource ('an email template'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its sibling 'delete-smtp-config', which follows the same pattern but targets a different resource, so it misses full sibling distinction.

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 like 'update-email-template' or prerequisites for deletion. The description merely states what it does without context about appropriate scenarios or warnings about irreversible actions.

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