imap_get_latest_emails
Fetch recent emails from a folder in reverse chronological order to see new incoming messages or recent inbox items without search filters. Optionally fetch message bodies in the same request.
Instructions
Get the most recent emails from a folder, newest first. Use this for "what just came in?" / "show my latest inbox messages" when no search filter is needed. By default returns lightweight headers (uid, from, subject, date); set includeBody=true to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per message. To filter by sender/subject/date instead, use imap_search_emails.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | No | Number of emails to retrieve | |
| folder | No | Folder name | INBOX |
| accountId | No | Account ID (from imap_list_accounts). Optional if accountName is given or only one account is configured. | |
| bodyFormat | No | How to render the body when `includeBody` is true. Mirrors `imap_get_email` — "markdown" (default) returns clean Markdown; "text" returns plain text; "html" returns raw HTML; "auto" prefers substantive text/plain, else Markdown. | markdown |
| accountName | No | Account name instead of accountId. Optional if accountId is given or only one account is configured. | |
| includeBody | No | If true, also fetch the parsed message body in the same round-trip and return it alongside headers (avoids the N+1 cost of calling imap_get_email per message). Body is rendered per `bodyFormat` and capped at `bodyMaxLength` characters per field. Off by default to preserve lightweight behavior. | |
| bodyMaxLength | No | Per-message cap (in characters) for each rendered body field when `includeBody` is true. Defaults to 10000 to match `imap_get_email`. |