Search messages
search_messagesSearch one account or all accounts for emails by sender, subject, date, folder, unread, flagged, or attachment; Gmail queries use Gmail syntax.
Instructions
Searches one account, or all with account="all". Gmail: query takes Gmail syntax (from:, newer_than:7d, has:attachment, label:); elsewhere full text plus the filters. Newest first, with uid + folder and header hints. Outlook: total counts returned results only; from is exact.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| limit | No | Default 20, max 50 | |
| query | No | Gmail syntax on Gmail, else plain text | |
| since | No | ISO date, e.g. 2026-09-01 | |
| before | No | ISO date | |
| folder | No | Default: Gmail All Mail, else INBOX | |
| offset | No | Hits to skip (keep small) | |
| unseen | No | Only unread | |
| account | Yes | "all", or a list_accounts id | |
| flagged | No | Only starred/flagged | |
| subject | No | ||
| has_attachment | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | ||
| messages | Yes |