read_email
Retrieve complete email content with markdown formatting and attachment details. Automatically marks unread messages as read when accessed.
Instructions
Get the full content of a specific email, including the markdown body and attachment metadata. Automatically marks unread emails as read. Use the email ID from check_inbox results.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| email_id | Yes | The email ID to read | |
| mailbox_id | No | Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided) |
Implementation Reference
- src/index.ts:144-148 (handler)The handler function that executes read_email logic. It retrieves the mailbox ID, makes an API GET request to /v1/mailboxes/{id}/emails/{email_id}, and returns the full email content including markdown body and attachment metadata.
async ({ email_id, mailbox_id }) => { const id = getMailboxId(mailbox_id); const data = await apiCall("GET", `/v1/mailboxes/${encodeURIComponent(id)}/emails/${encodeURIComponent(email_id)}`); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } - src/index.ts:141-143 (schema)Input validation schema using Zod for the read_email tool. Defines email_id (required string) and mailbox_id (optional string) parameters.
email_id: z.string().describe("The email ID to read"), mailbox_id: z.string().optional().describe("Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided)"), }, - src/index.ts:137-149 (registration)Tool registration using server.tool(). Registers 'read_email' with description, input schema, and handler function. The tool gets full email content and automatically marks unread emails as read.
server.tool( "read_email", "Get the full content of a specific email, including the markdown body and attachment metadata. Automatically marks unread emails as read. Use the email ID from check_inbox results.", { email_id: z.string().describe("The email ID to read"), mailbox_id: z.string().optional().describe("Mailbox ID (uses MULTIMAIL_MAILBOX_ID env var if not provided)"), }, async ({ email_id, mailbox_id }) => { const id = getMailboxId(mailbox_id); const data = await apiCall("GET", `/v1/mailboxes/${encodeURIComponent(id)}/emails/${encodeURIComponent(email_id)}`); return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; } );