search_emails
Search connected mailboxes. Results are compact summaries; use get_email to read a message. Without folderId, search uses Inbox in the selected connected mailbox(es); when accountId is omitted, it searches the connected mailboxes available to your account. To search Sent, Drafts, or another folder, first call list_mail_folders, then pass that folder's folderId together with the same accountId. This tool has no all-folders selector. Results may combine indexed matches with provider search. A nextCursor continues this same search and may advance provider traversal even when messages is empty; resume with that exact cursor and unchanged account, query, filters, and limit. Prefer that continuation over starting a new search. pendingAccountIds identifies mailboxes still searching. semanticPending:true means semantic results are not ready yet, even when messages is empty and nextCursor is absent. This is independent of provider freshness and pendingAccountIds. Only when there is no nextCursor and semanticPending is true, retry the identical query and filters once after about 500 ms, omitting cursor, and setting waitForFresh:false. Check semanticPending on the follow-up; if it remains true, treat results as incomplete rather than as no matches. failures identifies settled errors. Without nextCursor, a pending provider search can be checked later by repeating the identical query and filters without a cursor and with waitForFresh:false. Stale or pending results are not proof that a mailbox is empty. Set waitForFresh to wait briefly for a provider update; this bounded wait may return a cached, stale, or partial response at the deadline.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| sort | No | Text searches default to relevance. Inbox and folder lists default to newest first. Choose relevance, newest first, or oldest first explicitly. | |
| after | No | ||
| limit | No | ||
| query | No | ||
| before | No | ||
| cursor | No | ||
| isRead | No | ||
| subject | No | ||
| folderId | No | Opaque folder ID from list_mail_folders. Requires the same accountId because folders belong to one mailbox. | |
| accountId | No | ||
| isStarred | No | ||
| maxWaitMs | No | Maximum refresh wait in milliseconds (up to 15000). At the deadline, a cached copy may be returned with freshness metadata; this is not a guarantee of a fresh response. | |
| waitForFresh | No | Wait briefly for a provider refresh instead of immediately returning a cached copy. Check the returned freshness timestamps and stale/refreshing flags. | |
| hasAttachments | No |