Skip to main content

Module gmail

Module gmail 

Source
Expand description

The Gmail tool’s read actions (G3), named after Google’s Gmail MCP tools (SPEC_GOOGLE_CONNECTORS_GMAIL_CALENDAR_DRIVE_2026_10_14.md §5): search_threads, get_thread, list_labels.

As with Calendar and Drive, each action is a plan (the request, from the agent’s arguments) and a shape (Google’s answer, trimmed and capped); neither touches the network or a token. Google’s thread search answers with ids and a snippet only, so search_threads takes one more request per thread shown (summary_plan) for who wrote it, the subject and the date. Mail is written by other people: every text that comes back is cut to a length and the tool marks it untrusted (D6).

Structs§

GmailArgs
The arguments the read actions take. Unknown fields are ignored.

Constants§

EXTERNAL_PARTS
Stored text parts one get_thread fetches, and the longest one it takes (base64 characters).
EXTERNAL_PART_CHARS
READ_ACTIONS
The read actions, in the order the tool lists them.
SUMMARIZED
Threads of a search that get a subject and sender (one request each).

Functions§

external_text_parts
The (message id, attachment id) of every readable text part of thread whose text must be fetched separately, at most EXTERNAL_PARTS.
fill_external
Put the fetched text (parts: attachment id to the part’s base64url data) into the thread’s parts that name it.
granted_for
Whether granted (full scope URLs, or bare names) covers action. gmail.metadata can’t search or read bodies, so it covers list_labels alone.
logged_ids
The ids a read touched, for the account’s log (D7): never the search words or the mail.
needs
The scopes an action can run with: any one is enough. Only gmail.readonly is asked for here, but an account connected with a wider Gmail scope still works.
part_plan
The request for one stored text part.
plan
The request to Google for a read action.
raw_headers_arg
Whether get_thread is asked for the raw header lines (headers: "raw"); any other word is refused.
shape
Google’s answer to a read action, trimmed for the agent.
shape_search
search_threads’ answer: Google’s list and, for the first SUMMARIZED threads, what summary_plan found (summaries[i] is the answer for thread i, null when it failed).
shape_thread
A thread’s answer: each message with its text and sender check, and with its raw header lines when raw (headers: "raw").
summary_plan
The request for a found thread’s headers, for the line search_threads shows: who wrote it, the subject and date, and what its sender check reads (Google’s verdicts, the Reply-To), in the same call.