search_messages
Find individual Gmail messages with one row per result, returning headers, snippets, and labels. Use it to get a specific message ID for replying, forwarding, labeling, or fetching attachments.
Instructions
Search individual messages rather than threads: one row per message with headers, snippet and labels. Better than search_threads when you need a specific message ID (to reply, forward, label or fetch attachments) or a date-ordered list.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "search_messages"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Gmail search syntax, exactly as in the Gmail search box. Operators: from:, to:, cc:, bcc:, subject:, label:NAME, in:(inbox|sent|drafts|trash|spam|anywhere|archive), is:(unread|read|starred|important), has:attachment, filename:pdf, after:YYYY/MM/DD, before:YYYY/MM/DD, newer_than:7d, older_than:1y, larger:10M, "exact phrase", OR, -negation, ( ) grouping, {a b} for OR. Whitespace is AND. Keep queries keyword-based rather than pasting whole subjects. | |
| format | No | Per-message detail. Default "minimal" (no bodies). "plain_text" fetches bodies too: slower and larger. | |
| labelIds | No | Restrict to messages carrying all of these label IDs. | |
| pageToken | No | ||
| maxResults | No | Messages per page. Default 20. | |
| includeSpamTrash | No |