Skip to main content
Glama
railsware

Mailtrap Email Sending

by railsware

delete-template

Destructive

Remove email templates from Mailtrap Email Sending to manage your transactional email content and maintain clean template libraries.

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 deletes the template using the Mailtrap client and returns a success or error message.
    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 for the delete-template tool, defining 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 in the server's tools array, linking to its schema and handler.
    {
      name: "delete-template",
      description: "Delete an existing email template",
      inputSchema: deleteTemplateSchema,
      handler: deleteTemplate,
      annotations: {
        destructiveHint: true,
      },
    },
Behavior4/5

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

The annotations already declare destructiveHint=true, indicating this is a destructive operation. The description adds value by specifying 'Delete an existing email template,' which reinforces the destructive nature and clarifies the resource type. However, it doesn't provide additional behavioral details like confirmation prompts, error handling, or permissions required beyond what annotations imply.

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 no unnecessary words. It's front-loaded with the core action and resource, making it highly efficient and easy to parse. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's destructive nature (annotations cover this) and simple single-parameter schema, the description is adequate but minimal. It lacks output information (no schema provided) and doesn't address error cases or dependencies on other tools (e.g., needing to list templates first). For a destructive tool, more context would be beneficial.

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, with the 'template_id' parameter fully documented. The description doesn't add any parameter-specific information beyond what the schema provides, such as format examples or constraints. Since the schema coverage is high, the baseline score of 3 is appropriate.

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 its sibling 'update-template' or 'list-templates' in terms of scope or intent, which prevents a perfect score.

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 'update-template' or 'list-templates', nor does it mention prerequisites (e.g., needing a valid template_id). It simply states what the tool does without contextual usage information.

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/railsware/mailtrap-mcp'

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