Skip to main content
Glama

Mailtrap Email Sending

by railsware
listTemplates.ts1.33 kB
import { client } from "../../client"; async function listTemplates(): Promise<{ content: any[]; isError?: boolean }> { try { if (!client) { throw new Error("MAILTRAP_API_TOKEN environment variable is required"); } const templates = await client.templates.getList(); if (!templates || templates.length === 0) { return { content: [ { type: "text", text: "No templates found in your Mailtrap account.", }, ], }; } const templateList = templates .map( (template) => `• ${template.name} (ID: ${template.id}, UUID: ${template.uuid})\n Subject: ${template.subject}\n Category: ${template.category}\n Created: ${template.created_at}\n` ) .join("\n"); return { content: [ { type: "text", text: `Found ${templates.length} template(s):\n\n${templateList}`, }, ], }; } catch (error) { console.error("Error listing templates:", error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [ { type: "text", text: `Failed to list templates: ${errorMessage}`, }, ], isError: true, }; } } export default listTemplates;

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