Skip to the documentation
MCP server

Reading

Finding and reading mail.

Reading tools

ToolWhat it does
listThreadsList threads, with filters and pagination: newest, oldest, by sender or by subject, a date range, and only mail from contacts.
getThreadOne thread’s latest message in full, with its subject and sender.
waitForEmailWait up to 60 seconds for a message to arrive and return the first that matches from, subject, address and since, or say that none came. It is how an agent waits for a sign-in code it asked a service to send, before reading it with getThread or readVerificationCode. It needs threads:read, and a key or app limited to some addresses waits only for theirs.
getThreadSummaryAn AI summary of one thread.
getRawMessageThe source of one message as text, headers and MIME body, up to 256 KiB. source says whether it is the original as it arrived or rebuilt from the stored message, and truncated whether there is more. Without a message id it reads the latest message of the thread.
getCurrentDateThe current date and time, for relative queries.
getMailboxCountsHow many conversations each folder holds and how many are unread, as the sidebar shows them, how many drafts are waiting, what each label holds in each folder, and how many inbox conversations arrived at each address. address counts the mail of one.
getSenderProfileWhat is known about the organisation behind a sender, the line the reading pane shows, and the picture the app shows for it. research looks a new one up, which only the workspace owner may do.

getThread returns the LATEST message, not the whole thread. For every message in a conversation use GET /threads/{id} on the REST API instead.

getCurrentDate exists because a model has no clock. Without it, "emails from last week" is computed against whenever the model was trained.

Reference

listThreads

Scopesthreads:readThe app's assistant runs it without askingToolkitcore

List email threads with optional filters, one page at a time. When more follow, the last line gives a pageToken: call again with the same filters and that pageToken for the next page, until none is given. sort is newest (the default), oldest, sender or subject, the same four orders the thread list offers. dateFrom and dateTo are ISO 8601 instants, both included, read against the newest message on each thread. fromContacts keeps only threads whose newest message came from a saved contact. A thread whose newest message arrived encrypted is marked as such on its own line: its subject, sender and date are listed exactly as any other thread’s, but getThread will not return a body for it. Read the marker before planning a call that needs the text. Set semantic to true when the person describes mail rather than naming its words: query then matches by meaning and the closest threads come first. address keeps only the threads delivered to that one address, as the address filter of the app does. category keeps one inbox tab: primary, promotions, updates, social or forums.

Inputs

folderstring
Default"inbox"
querystring

Mailbox search query. Plain words match loosely (case, accents and separators ignored, parts of words count) against the sender, recipients, subject, body and attachment names, and must all appear. When nothing matches exactly, close spellings are returned instead (benjimin finds Benjamin); a quoted phrase, a number and an excluded word always match exactly. Operators: from:, to:, subject:, body:, label:, in:inbox|sent|drafts|spam|trash|archive|anywhere, is:unread|read|starred|important|snoozed|muted|waiting (sent with a reminder and not answered yet)|subscription (mail from a newsletter or mailing list), category:primary|promotions|updates|social|forums (the inbox tab a thread is sorted into), has:attachment|pdf|image, filename:, after:YYYY/MM/DD, before:YYYY/MM/DD, newer_than:7d, older_than:1m. Quote values with spaces, use OR and parentheses for alternatives, and a leading - to exclude. Example: from:stripe has:pdf newer_than:30d

semanticboolean

When true, the plain words in query match by meaning instead of spelling. Describe the mail in a few words (flight to Berlin, invoices I still owe) and the closest threads come back best match first, along with any thread that contains the words. Operators such as from:, label:, is:unread and dates still filter, and sort does not apply. Meaning is read from the whole conversation, newest messages first. A thread with an encrypted message is found only by its sender, subject and labels, and a workspace that turned search by meaning off in its settings gets a text search.

maxResultsinteger
At least 1At most 25Default5
labelIdsstring[]
sortstring
One of"newest""oldest""sender""subject"
dateFromstring
Formatdate-time
dateTostring
Formatdate-time
fromContactsboolean
addressstring
3 to 320 characters
categorystring

Keeps only the threads sorted into one inbox tab: primary, promotions, updates, social or forums. primary is every inbox thread in no other tab. It applies to the inbox only.

One of"primary""promotions""updates""social""forums"
pageTokenstring

Also available in

API
GET /threads
TypeScript
threads.list()threads.listAll()threads.iterate()
Python
threads.list()threads.list_all()threads.iterate()
Ruby
threads.listthreads.list_allthreads.iterate
PHP
threads->listthreads->listAllthreads->iterate
Go
Threads.ListThreads.ListAllThreads.Iterate
Java
threads().listthreads().listAllthreads().iterate
C#
Threads.ListAsyncThreads.ListAllAsyncThreads.IterateAsync

getThread

Scopesthreads:readThe app's assistant runs it without askingToolkitcore

Get detailed information about a specific email thread. A message that arrived encrypted (PGP or S/MIME) returns a marker in place of its body rather than any text: this server holds no key and cannot open it, and no retry will change that. Sender, subject, date and labels are not hidden by encryption and come back in full. Relay such a message as encrypted. Never report it as empty. When the latest message is a sign-in or verification code email from an authenticated sender and holds exactly one code, that code comes back on its own line.

Inputs

threadIdstringRequired

Also available in

API
GET /threads/{id}GET /threads/{id}/automations
TypeScript
threads.get()threads.listAutomations()
Python
threads.get()threads.list_automations()
Ruby
threads.getthreads.list_automations
PHP
threads->getthreads->listAutomations
Go
Threads.GetThreads.ListAutomations
Java
threads().getthreads().listAutomations
C#
Threads.GetAsyncThreads.ListAutomationsAsync

waitForEmail

Scopesthreads:readThe app's assistant runs it without askingToolkitworkspace

Wait for an email to arrive, for up to 60 seconds, and return the first message that matches: the oldest one that arrived after since. Use it right after asking a service to send a sign-in or verification code, then read the message with getThread or pass it to readVerificationCode. from matches the sender address or name and subject the subject, as text anywhere in them in any case, and address keeps only mail delivered to that address. Mail the workspace sent itself never matches. It answers that nothing arrived when the wait runs out, so call it again to keep waiting.

Inputs

addressstring

One of your addresses: only mail delivered to it.

Up to 320 characters
fromstring

Text the sender address or name contains, such as github.com.

Up to 320 characters
subjectstring

Text the subject contains, such as "code".

Up to 200 characters
sincestring

Only mail that arrived at or after this moment, at most 24 hours ago. Left out, now.

Formatdate-time
timeoutinteger

Seconds to wait, 30 when left out.

At least 0At most 60

getThreadSummary

Scopesthreads:readThe app's assistant runs it without askingToolkitcore

Get the summary of a specific email thread. A thread holding a message that arrived encrypted (PGP or S/MIME) is never summarised (its body was never read), and this says so rather than reporting that no summary exists. A thread that was summarised before an encrypted message arrived in it returns that older summary, labelled as not covering the encrypted one.

Inputs

idstringRequired

Also available in

API
GET /threads/{id}/summary
TypeScript
threads.summary()
Python
threads.summary()
Ruby
threads.summary
PHP
threads->summary
Go
Threads.Summary
Java
threads().summary
C#
Threads.SummaryAsync

getRawMessage

Scopesthreads:readThe app's assistant runs it without askingToolkitfiles

The source of one message of a thread, as text: its headers and MIME body, the way a mail app shows it under Show original. source says which it is: original is the message byte for byte as it arrived, kept only for mail an address received while it had Keep original on, and rebuilt is the source rebuilt from the stored message, the same bytes a mail app reads over IMAP. At most the first 256 KiB come back, and truncated says when there is more. Leave out messageId for the latest message of the thread.

Inputs

threadIdstringRequired
1 to 255 characters
messageIdstring

The message, as emailId in an email.received webhook or id on a message of GET /threads/{id}/messages. Left out, the latest message of the thread.

1 to 255 characters

Also available in

API
GET /threads/{id}/messages/{messageId}/raw
TypeScript
threads.getRawMessage()
Python
threads.get_raw_message()
Ruby
threads.get_raw_message
PHP
threads->getRawMessage
Go
Threads.GetRawMessage
Java
threads().getRawMessage
C#
Threads.GetRawMessageAsync

getCurrentDate

No scopeThe app's assistant runs it without askingToolkitcore

Get the current date and time

Inputs

Takes no input.

getMailboxCounts

Scopesthreads:readThe app's assistant runs it without askingToolkitcore

How many conversations each folder holds and how many of them are unread, as the sidebar shows them, how many drafts are waiting, how many conversations each label has in each folder, and how many inbox conversations arrived at each address. The unread row counts the unread conversations in the inbox, and the draft row counts drafts. The tab rows count the inbox conversations in each inbox tab (primary, promotions, updates, social, forums) and how many of them are unread. The unlabelled rows count the inbox conversations that carry none of the labels, in total and by tab, which is what the inbox of the app lists unless Labelled mail is ticked in its Filters menu. The team rows count the open conversations assigned to you and the open conversations nobody has, leaving out labelled mail the same way unless you show it in the inbox, and the conversations that mention you, with how many of those mentions you have not opened yet. hideLabelled true leaves labelled mail out of the team rows and false counts it, whatever the inbox shows. address narrows every count to mail delivered to that one address.

Inputs

addressstring
3 to 320 characters
hideLabelledboolean

Also available in

API
GET /threads/counts
TypeScript
threads.counts()
Python
threads.counts()
Ruby
threads.counts
PHP
threads->counts
Go
Threads.Counts
Java
threads().counts
C#
Threads.CountsAsync

getSenderProfile

Scopesthreads:readThe app's assistant runs it without askingToolkitcore

What is known about the organisation behind a sender: the line the reading pane shows under an unfamiliar sender, kept per domain and shared by every address under it, subdomains included, and looked up again after 30 days. Give any address of the sender; only its domain is read. Personal mailbox providers such as Gmail and the domains of this workspace are never looked up. research true looks a domain nobody has looked up yet up on the web and keeps the answer, which only the workspace owner may do, with a connection that reaches every address. Every answer also gives the picture the app shows for the sender: a member, address or contact photo, the domain logo, or one found on Gravatar or the sender website.

Inputs

emailstringRequired
3 to 320 characters
researchboolean

Also available in

API
GET /senders/{email}GET /senders/{email}/avatarPOST /senders/{email}/research
TypeScript
senders.get()senders.getAvatar()senders.research()
Python
senders.get()senders.get_avatar()senders.research()
Ruby
senders.getsenders.get_avatarsenders.research
PHP
senders->getsenders->getAvatarsenders->research
Go
Senders.GetSenders.GetAvatarSenders.Research
Java
senders().getsenders().getAvatarsenders().research
C#
Senders.GetAsyncSenders.GetAvatarAsyncSenders.ResearchAsync