Skip to main content
Glama

get_thread

Read-only

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

NameRequiredDescriptionDefault
thread_idYes
local_pathNo
include_bodyNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only supply readOnlyHint=true, yet the description discloses the response-size cap, the error raised when exceeded, path-resolution failures (ValueError on a file as parent or trailing-slash path), replacement of an existing file, and both inline and written-file return shapes including body_fetch_errors/body_decode_errors. That is unusually rich behavioral context; the only mild tension is that local_path writes to disk, a side effect the readOnlyHint does not signal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded one-line purpose followed by clearly separated Args and Returns sections with no filler. The local_path paragraph is dense but each clause encodes a distinct failure or overwrite rule, so it is verbosity with purpose rather than padding.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers the full lifecycle of a call for a three-parameter tool: inputs, size limits, on-disk alternative, error payloads, and partial-failure fields. Even with an output schema present, the extra error and file-handling detail is what an agent needs to choose a path safely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description carries the full burden and does: thread_id's provenance, local_path's file-vs-directory semantics, creation and overwrite rules, and include_body's exact effect (metadata format, omitted body_plain/body_html/attachments). Nothing needed to call the tool correctly is left undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('Fetch all messages in a conversation thread') and ties the result shape to get_message, so an agent can tell exactly what it gets back. It also names the source of the ID (list_threads or a message's thread_id), anchoring the tool in the workflow.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete when-to-use guidance for the non-default paths: include_body=False is for threads too large to read whole, followed by get_message per ID, and local_path is for threads over the response-size cap. It does not explicitly state the default-case routing versus get_message or list_messages, but the parameter-level context is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools