Skip to main content
Glama
mailtrap

MCP Mailtrap Server

Official
by mailtrap

delete-template

Destructive

Remove an email template from the Mailtrap MCP server by specifying its ID to clean up unused or outdated templates.

Instructions

Delete an existing email template

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
template_idYesID of the template to delete

Implementation Reference

  • The main handler function for the 'delete-template' tool. It uses the Mailtrap client to delete the template by ID and returns a success or error message in the specified format.
    async function deleteTemplate({
      template_id,
    }: DeleteTemplateRequest): Promise<{ content: any[]; isError?: boolean }> {
      try {
        if (!client) {
          throw new Error("MAILTRAP_API_TOKEN environment variable is required");
        }
    
        await client.templates.delete(template_id);
    
        return {
          content: [
            {
              type: "text",
              text: `Template with ID ${template_id} deleted successfully!`,
            },
          ],
        };
      } catch (error) {
        console.error("Error deleting template:", error);
    
        const errorMessage = error instanceof Error ? error.message : String(error);
    
        return {
          content: [
            {
              type: "text",
              text: `Failed to delete template: ${errorMessage}`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema (JSON Schema) for the 'delete-template' tool, validating the required 'template_id' parameter.
    const deleteTemplateSchema = {
      type: "object",
      properties: {
        template_id: {
          type: "number",
          description: "ID of the template to delete",
        },
      },
      required: ["template_id"],
      additionalProperties: false,
    };
    
    export default deleteTemplateSchema;
  • src/server.ts:73-81 (registration)
    Registration of the 'delete-template' tool within the tools array in the MCP server setup.
    {
      name: "delete-template",
      description: "Delete an existing email template",
      inputSchema: deleteTemplateSchema,
      handler: deleteTemplate,
      annotations: {
        destructiveHint: true,
      },
    },
Behavior3/5

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

The description adds minimal behavioral context beyond the annotations. Annotations already declare destructiveHint=true, indicating this is a permanent deletion. The description confirms this with 'Delete' but doesn't elaborate on consequences (e.g., irreversible, no recovery) or permissions required. It doesn't contradict annotations, but provides little extra value.

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, direct sentence with zero wasted words. It front-loads the core action and resource, making it highly efficient. Every word earns its place, achieving optimal conciseness for a simple tool.

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 destructive nature (annotations show destructiveHint=true) and lack of output schema, the description is incomplete. It doesn't address critical context like what happens post-deletion (e.g., success confirmation, error handling), or tie into the sibling ecosystem (e.g., use after 'list-templates'). For a mutation tool with safety implications, this is inadequate.

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?

With 100% schema description coverage, the input schema fully documents the single parameter 'template_id'. The description adds no additional meaning about parameters, such as format examples or sourcing guidance. This meets the baseline for high schema coverage but doesn't enhance understanding.

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 existing email template'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'update-template' or 'list-templates' beyond the basic verb, missing an opportunity to clarify its specific role in the template management workflow.

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. It doesn't mention prerequisites (e.g., needing a template ID from 'list-templates'), exclusions (e.g., not for sandbox templates), or comparisons to siblings like 'update-template' for modifications. This leaves the agent without context for 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/mailtrap/mailtrap-mcp'

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