Skip to main content
Glama
mailtrap

MCP Mailtrap Server

Official
by mailtrap

delete-template

Remove unwanted email templates from your Mailtrap account to maintain clean template management and eliminate clutter from your email testing environment.

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 specified 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, }; } }
  • The input schema defining the 'template_id' parameter required for the delete-template tool.
    const deleteTemplateSchema = { type: "object", properties: { template_id: { type: "number", description: "ID of the template to delete", }, }, required: ["template_id"], additionalProperties: false, };
  • src/server.ts:74-81 (registration)
    Registration of the 'delete-template' tool in the server's tools array, specifying name, description, schema, handler, and annotations.
    name: "delete-template", description: "Delete an existing email template", inputSchema: deleteTemplateSchema, handler: deleteTemplate, annotations: { destructiveHint: true, }, },

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