View as Markdown
Gmail icon

Gmail ACTION

Get Thread

Fetch an entire Gmail thread (conversation) by thread ID — returns every message in order with headers, decoded body text, and attachment metadata. Use this after Find Emails when the user wants the full conversation rather than a single message. Each result from Find Emails includes a threadId you can pass here. With format: full (default) each message includes decoded text/html bodies and attachment metadata. Use format: metadata to skip bodies and get only headers + labelIds — useful for large threads. Responses are capped — oversized threads fall back to metadata-level detail (or are further truncated from the tail) with a [truncated] marker so the caller knows to narrow the request. See the documentation.
  • Action
  • Read only
  • OAuth
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Gmail account once, then configure and run Get Thread from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "gmail-list-thread-messages",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    gmail: { authProvisionId: "apn_xxxxxxx" },
    threadId: "Thread ID",
    format: "Format",
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Get Thread inputs
Property Type Description
threadId Thread ID string
The thread identifier. Obtain this from the threadId field on a message returned by Find Emails.
Required
format Format string
full (default) returns each message with headers and decoded bodies. metadata returns only headers + labelIds (no body, no attachments) — use when the thread is long and you only need to enumerate its messages.
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
gmail-list-thread-messages
Version
0.2.1
App
Gmail
Authentication
OAuth
Read-only
Yes
Destructive
No
Open world
Yes