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. freshness.checkedAt is the last confirmed check for this result scope: treat recent results as usable within the ten-minute freshness window and do not raise a freshness warning within the thirty-minute tolerance window. A recent checkedAt stays usable when freshness.stale is true or freshness.refreshing is true; those flags can reflect cache maintenance or an incomplete snapshot, not a provider failure. Missing checkedAt means the age is unknown and is not itself evidence that messages are stale. coverage.complete and cachedSubset describe search coverage independently from the age of returned messages. Only when there is no nextCursor and semanticPending is true, retry the identical query and filters once after about five seconds, 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. A pending cursor or incomplete coverage is not proof that a mailbox is empty; continue that exact search when a complete answer is required. Set waitForFresh only when the user explicitly asks for a live refresh. If that bounded wait expires, return the cached matches and last confirmed check time without describing the timeout itself as a mail failure.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search_emails"
}
}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 |