Search Gmail threads
gmail_search_threadsSearch Gmail threads using full search syntax, across a single account or all accounts at once, returning thread summaries with pagination and per-account error handling.
Instructions
Search threads with full Gmail search syntax, in one account or across all stored accounts.
Args:
query (string, required): Gmail search syntax. Examples: 'from:alice@example.com is:unread', 'newer_than:7d', 'has:attachment subject:"invoice"', 'to:me label:starred'.
account (string, optional): email or alias to search; the literal 'all' fans out to every stored account concurrently, merges results by date (newest first), and tags each thread with its account. Omit for the default account.
max_results (1–50, default 10): per-account cap.
page_token (optional): continue a previous single-account search. NOT supported with account:'all' — in that mode each account instead reports has_more; narrow the query or search one account to paginate.
response_format: 'markdown' (default) or 'json'.
Returns: thread-level summaries only (thread_id, account, participants, date, subject, snippet, message_count) — never full bodies. Use gmail_get_thread with the thread_id AND the same account to read a thread.
Examples:
{"query": "is:unread newer_than:2d"}
{"query": "subject:"invoice" has:attachment", "account": "all", "max_results": 20}
Error Handling: in 'all' mode, per-account failures are reported inline without failing the whole call. Expired credentials return a re-auth instruction naming the affected account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Gmail search query (full Gmail search syntax). Examples: 'from:alice@example.com is:unread', 'newer_than:7d', 'has:attachment subject:"invoice"', 'label:important older_than:1m'. | |
| account | No | Email or alias to search, or the literal string 'all' to fan out across every stored account (results are merged by date and tagged with their account). Omit to use the default account. | |
| page_token | No | Pagination token from a previous single-account search. Not supported with account: 'all'. | |
| max_results | No | Maximum threads to return (per account in 'all' mode). 1–50, default 10. | |
| response_format | No | Output format: 'markdown' for compact human-readable rendering (default), 'json' for the full normalized structure. | markdown |