get_email
Retrieve email details and delivery events by providing an email ID to track message status and content.
Instructions
Get details of a specific email including delivery events
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Email ID |
Implementation Reference
- src/index.ts:380-385 (handler)Handler function for the 'get_email' tool that fetches specific email details from the GetMailer API using the provided ID and returns the result as formatted JSON text.case 'get_email': { const result = await apiRequest(`/api/emails/${args?.id}`); return { content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }], }; }
- src/index.ts:139-148 (schema)Input schema definition for the 'get_email' tool, requiring a string 'id' parameter for the email ID.inputSchema: { type: 'object' as const, properties: { id: { type: 'string', description: 'Email ID', }, }, required: ['id'], },
- src/index.ts:136-149 (registration)Registration of the 'get_email' tool in the ListTools response, including name, description, and input schema.{ name: 'get_email', description: 'Get details of a specific email including delivery events', inputSchema: { type: 'object' as const, properties: { id: { type: 'string', description: 'Email ID', }, }, required: ['id'], }, },
- src/index.ts:21-48 (helper)Helper function 'apiRequest' used by the get_email handler to make authenticated HTTP requests to the GetMailer API.async function apiRequest<T>( endpoint: string, options: RequestInit = {} ): Promise<T> { const url = `${API_URL}${endpoint}`; const response = await fetch(url, { ...options, headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${API_KEY}`, ...options.headers, }, }); if (!response.ok) { let errorMessage = response.statusText; try { const errorData = await response.json(); errorMessage = errorData.error || errorData.message || errorMessage; } catch { // Ignore } throw new Error(`API Error: ${errorMessage}`); } return response.json(); }