Tool: search_threads
Lists email threads from the authenticated user's Gmail account.
This tool can filter threads based on a query string and supports pagination. It returns a list of threads, including their IDs and related messages. Each related message contains details like a snippet of the message body, the subject, the sender, the recipients etc. Note that the full message bodies are not returned by this tool; use the 'get_thread' tool with a thread ID to fetch the full message body if needed.
The following sample demonstrate how to use curl
to invoke the search_threads
MCP tool.
| Curl Request |
|---|
curl --location 'https://gmailmcp.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "search_threads", "arguments": { // provide these details according to the tool MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
Request message for SearchThreads RPC.
SearchThreadsRequest
| JSON representation |
|---|
{ "pageSize" : integer "pageToken" : string "query" : string "includeTrash" : boolean } |
Union field _page_size
.
_page_size
can be only one of the following:
pageSize
integer
Optional. The maximum number of threads to return. If unspecified, defaults to 20. The maximum allowed value is 50.
Union field _page_token
.
_page_token
can be only one of the following:
pageToken
string
Optional. Page token to retrieve a specific page of results in the list. Leave empty to fetch the first page.
Union field _query
.
_query
can be only one of the following:
query
string
Optional. A query string to filter the threads, using the same format as the Gmail search bar. If omitted, all threads (excluding spam and trash by default) are listed. Key Operators: from:
Examples:
"subject:OneMCP Update"
"from:gduser1@workspacesamples.dev"
"to:gduser2@workspacesamples.dev AND newer_than:7d"
"project proposal has:attachment"
"is:unread"
Union field _include_trash
.
_include_trash
can be only one of the following:
includeTrash
boolean
Optional. Include drafts from TRASH in the results. Defaults to false.
Output Schema
Response message for SearchThreads RPC.
SearchThreadsResponse
| JSON representation |
|---|
{
"threads"
:
[
{
object (
|
| Fields | |
|---|---|
threads[]
|
List of thread summaries. |
nextPageToken
|
A token that can be used in a subsequent call to retrieve the next page of threads. Present only if there are more results. |
Thread
| JSON representation |
|---|
{
"id"
:
string
,
"messages"
:
[
{
object (
|
| Fields | |
|---|---|
id
|
The unique identifier of the thread. |
messages[]
|
A list of messages in the thread, ordered chronologically. |
Message
| JSON representation |
|---|
{ "id" : string , "snippet" : string , "subject" : string , "sender" : string , "toRecipients" : [ string ] , "ccRecipients" : [ string ] , "date" : string , "plaintextBody" : string } |
| Fields | |
|---|---|
id
|
The unique identifier of the message. |
snippet
|
Snippet of the message body. |
subject
|
The message subject extracted from headers: |
sender
|
Sender email address. |
toRecipients[]
|
To recipient email addresses. |
ccRecipients[]
|
CC recipient email addresses. |
date
|
Date of the message in ISO 8601 format (YYYY-MM-DD). |
plaintextBody
|
Full body content, only populated if MessageFormat was FULL_CONTENT. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌

