search_emails
Find Gmail messages across one or all enabled accounts using Gmail query syntax for sender, date, attachments, labels, and read status. Returns matches with paging and thread IDs.
Instructions
Search Gmail using standard Gmail query syntax. Omitting account searches all enabled inboxes and merges results; pass account ("personal", "tamu") to scope to one. Returns individual messages, not threads — use get_email_thread with the returned Thread ID to see replies and full message bodies. Supported: from: to: cc: subject: after:/before:YYYY/MM/DD newer_than:/older_than: (e.g. 7d, 1y) has:attachment filename: is:unread/starred/important in:inbox/sent/trash/anywhere category: larger:/smaller:, "exact phrase", - to negate, OR or {a b} to match either, ( ) to group. label: takes the label's DISPLAY NAME, not its id — quote names with spaces: label:"BROH Internship". (A Label_... id would match nothing in Gmail, so this server rewrites recognized ids to the matching display name for you; prefer the name anyway.) Archived and sent mail are included by default; use in:inbox to restrict. Each result lists its label ids and names (UNREAD, STARRED, IMPORTANT, SENT, user labels). Bodies are not included — use read_emails(include_body=true) or get_email_thread. "Estimated Total Matches" is Gmail's own resultSizeEstimate for the whole query and is approximate; use page_token to page through everything.
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": {
"query": "<query>"
},
"name": "search_emails"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Gmail search query, e.g. `from:alice@example.com newer_than:30d has:attachment`. | |
| account | No | Optional account id ("personal", "tamu"). Omit to aggregate across all enabled accounts. | |
| page_token | No | Token from a previous call's "Next Page Token" to fetch the next page. Reuse the SAME query, max_results and `account` scope — the token records every queried account's position, including matches already fetched but not shown, and is rejected with an explanation if the scope changed. | |
| max_results | No | Maximum emails to return per account (1-500). |