get_thread
Fetches all messages in a Gmail conversation thread by thread ID, with options to omit message bodies or write large thread JSON to a local file.
Instructions
Fetch all messages in a conversation thread.
Args: thread_id: The Gmail thread ID (from list_threads or a message's thread_id). local_path: Optional local filesystem path (file or directory) to write the thread JSON to instead of returning it inline. Bypasses the response-size cap, for threads with very large bodies. A path ending in '/' is a directory, created if missing. A file in place of a parent directory, or at a path ending in '/', raises ValueError; an existing file at a plain file path is replaced. include_body: When False, fetch only each message's metadata (Gmail's format='metadata'): no body is downloaded, and body_plain, body_html, and attachments are left out. Use it to list a thread too large to read whole, then get_message each ID.
Returns: Thread with id, snippet, history_id, and messages (same shape as get_message, including its include_body=False shape). Raises an error naming the size if the thread is over the response-size cap and local_path is not set. If local_path is set, returns {local_path, thread_id, message_count, bytes_written} instead, plus body_fetch_errors / body_decode_errors (each entry with message_id) when present. On API failure, {"error": "..."}.
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": {
"thread_id": "<thread_id>"
},
"name": "get_thread"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | Yes | ||
| local_path | No | ||
| include_body | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||