Search a mailbox
messages_listSearch one connected mailbox in its own provider's query language, Gmail's or Outlook's, narrowed by the inputs beside q, or list its mail by those inputs alone. An Outlook mailbox without q reads one folder, the inbox unless folder names another, in order; with q it searches every folder and leaves off each page what the other inputs rule out, filtered counting them, so a short page can have more after it, and it answers no match past its 1,000th, ceiling marking the page where it stopped. Any other mailbox whose provider is imap leaves off each page what an instant, a size or has:attachment rules out, filtered counting them, and names under notSearched each folder the call had no time left to search. A message whose recipients one answer cannot carry names the first that fit, omittedRecipients counting the rest. The times it answers with carry their offset in the person's own time zone, which the answer names under now beside their time now in it - UTC where the person has stored no zone, as now says.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"mailbox": "<mailbox>"
},
"name": "messages_list"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | No | A Gmail mailbox, whatever its provider, reads Gmail's search operators: from:, to:, cc:, subject:, is:unread, is:starred, in:sent, has:attachment, filename:pdf, after:2026/01/31, before:, newer_than:7d, larger:5M, OR, -word and ( ). An Outlook mailbox reads Microsoft's keyword query language - from:, to:, cc:, subject:, body:, received:, hasAttachments:true, plain words and quoted phrases, AND, OR and NOT in capitals - and never a filter expression such as isRead eq false. A few distinctive words, with OR between alternatives, miss less than a copied subject line or sentence. Any other mailbox whose provider is imap reads only from:, to: and cc: (never me), subject:, plain words and quoted phrases, -word or -"a phrase" leaving it out, is:unread, one run of OR between any of those (as a OR b OR c), has:attachment, and larger: and smaller: in bytes or as 500K or 5M, after: and before: as 2026/01/31, newer_than: in days, months or years, and one in: or label: naming one folder, by the name labels_list gives a label of type user or as inbox, sent, archive, drafts, spam or trash, a name holding a space quoted and a quote or backslash inside the quotes taking a backslash before it, with no AND or NOT, and is searched by message in every folder but the bin and junk. after: and before: written as a bare date open at midnight in the person's own time zone, save in an Outlook mailbox's query, whose dates Microsoft reads itself. | |
| by | No | message, the default, answers each matching message; thread answers each matching thread with every message in it. | |
| view | No | summary, the default, carries each message's subject and snippet; headers leaves both out; compact, the lightest page, carries only each message's id, threadId, sender, date, unread mark, subject and the first 100 characters of its snippet. | |
| after | No | Only mail that arrived at or after this instant, with its offset, as 2026-10-20T00:00:00Z. | |
| focus | No | Outlook alone: focused answers the mail Outlook sorts into Focused, other the mail in Other. Outlook sorts its inbox alone, and reads mail in every other folder as focused. | |
| order | No | newest, the default, answers the newest mail first; oldest the oldest. Gmail answers newest first alone, and so does Outlook with q. | |
| before | No | Only mail that arrived before this instant, written and read as after is. | |
| folder | No | One folder to search: inbox, sent, archive, drafts, deleted or junk, or a folder's id from labels_list - on a Gmail connected by Google sign-in any label's, on Outlook a folder's and never a category's. A mailbox whose provider is imap takes no folder in q beside it. | |
| unread | No | true answers unread mail alone, false read mail alone. | |
| flagged | No | true answers flagged mail alone - starred on Gmail, flagged on Outlook - false the rest. | |
| mailbox | Yes | The mailbox's name or its email address. | |
| pageToken | No | The nextPageToken of the page before, asked with every other input the same. Outlook, and a Gmail whose provider is imap, page threads by their matching messages, so a thread can recur on a later page. | |
| maxResults | No | How many results to take, 10 where left out. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| now | Yes | The person's own time zone, in which every time this answer gives is written, and their time now in it. | |
| more | Yes | ||
| shown | Yes | ||
| ceiling | No | ||
| omitted | No | ||
| threads | No | ||
| filtered | No | ||
| messages | No | ||
| newestOnly | No | The folders whose provider showed only their newest messages, each with how many it showed: every one holds more, and nothing before those was read, searched, counted or acted on, so finding nothing there says nothing of the rest. | |
| unreadable | Yes | ||
| notSearched | No | ||
| nextPageToken | Yes | ||
| screeningWait | No | Present where a message is marked not_yet_screened: the seconds to wait before reading those messages by their ids. | |
| resultSizeEstimate | Yes |