Search messages
search_messagesFind emails across accounts using filters for sender, subject, date, folder, unread/flagged status, and attachments. Returns newest-first results with UID and folder for follow-up actions.
Instructions
Searches one account (or all accounts with account="all"). On Gmail, query accepts full Gmail search syntax (from:, newer_than:7d, has:attachment, label:, "exact phrase"). Elsewhere query is full-text and the structured filters do the rest. Returns newest first with uid + folder needed by other tools.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | ||
| from | No | ||
| limit | No | Default 20, max 50 | |
| query | No | Gmail search syntax on Gmail; plain text elsewhere | |
| since | No | ISO date, e.g. 2026-09-01 | |
| before | No | ISO date | |
| folder | No | Folder/label path. Defaults to All Mail on Gmail, INBOX elsewhere. | |
| offset | No | ||
| unseen | No | Only unread | |
| account | Yes | Account id, or "all" to search every readable account | |
| flagged | No | Only starred/flagged | |
| subject | No | ||
| has_attachment | No |