Skip to main content
Glama

Fetch a mail thread

mail_fetch_thread
Read-onlyIdempotent

Fetch an entire email reply chain in one call, folding repeated quoted text into markers so you can summarize threads, find decisions, and reconstruct who asked what.

Instructions

Reads a whole reply chain in one call and folds away the text the messages repeat at each other. Use it instead of looping mail_get_message whenever you want two or more messages of one conversation — summarising a thread, finding when something was decided, reconstructing who asked what. Pass fromMessageId (any message id from the thread, and the server finds the rest) or ids (an explicit list, which also works across conversations). Messages come back oldest-first as messages, each with an n you can cite. Where a message quotes text an earlier one already carried, the quote is replaced by a marker like [quoted from #3] or [quoted from #2-#5]; every index named is a message in this same response and always lower than the one citing it, so nothing points outside what you were given. On a measured 24-message Outlook thread this returned 92,000 characters where 24 separate mail_get_message calls returned 381,000, with no unique sentence lost. Read meta.fold to see how much was folded and meta.budget to see whether bodies were cut. reason is "complete" when you have the whole conversation, "maxMessages" when only the newest maxMessages of a longer thread came back, and "maxPages" when the conversation is longer than this tool will page — there is no cursor, because a pointer on page 2 could not name a message on page 1, so narrow with mail_search_messages and pass ids instead. A message tagged bodyRendering:"stripped-html" reached us as HTML and lost every link on the way through the tag stripper; linksLost counts them. Nothing here is marked read, and attachment contents are never included.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsNoExplicit message ids, 1-50, fetched in one $batch. Use this to fold across messages that are NOT one conversation — notification mail from one service shares a footer but not a conversationId. Order does not matter: the result is always sorted oldest-first before folding, so the same ids in any order return the same bytes. Ids that fail are listed in meta.missing rather than failing the call.
foldNoHow to handle text that repeats across the returned messages. "pointers" (the default) replaces a repeat with a marker naming the message that carried it first, such as [quoted from #3]. "off" returns every message whole and is typically four times larger; use it only if you must read a quoted copy verbatim.pointers
foldLinksNoAs in mail_get_message: replace click-tracking URLs over 200 characters.
maxMessagesNofromMessageId mode only. How many messages of the conversation to return, newest-first from the mailbox and then re-sorted oldest-first. Defaults to 20. There is no cursor: a pointer in page 2 could not name a message in page 1, so a longer thread is reported with reason:"maxMessages" and narrowed with ids instead.
maxBodyCharsNoOptional hard ceiling on any single message body, applied AFTER folding. There is no default on purpose: the one message in a chain that matters is often the long one, and a per-message cap cuts exactly that. Leave it unset and let totalBodyChars bind, which shares the budget fairly instead of clipping every message to the same length.
fromMessageIdNoAny message id from the thread you want — typically one a search returned. The server reads its conversationId and fetches the rest, so you never have to hold a conversationId yourself. Pass this OR ids, not both.
totalBodyCharsNoCeiling on all bodies in this response together, default 30000 and clamped to the server's own output cap. This is the limit that actually binds — raise it, not maxBodyChars, when you want more text. Budget is shared fairly: a short message is never truncated to make room for a long one.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.5.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare readOnly/idempotent/non-destructive, yet the description adds substantial context beyond them: quote-fold markers with guaranteed in-response indices, meta.fold and meta.budget, the three reason values including the no-cursor rationale, bodyRendering:'stripped-html' with linksLost, plus the explicit notes that nothing is marked read and attachments are never included.

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 with purpose and alternative in the first sentence, then dense return-value detail. Length is justified by the absence of an output schema, though it is on the verbose side and could tighten slightly.

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?

With no output schema, the description carries the full return-value burden and does so: it documents result ordering and the `n` citation index, meta.fold/meta.budget, all reason values, and the stripped-html caveat. Nothing an agent needs to call and interpret the result correctly is missing.

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

Parameters3/5

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

Schema description coverage is 100% and the parameter docs are already rich, so baseline is 3. The description reinforces fromMessageId (any id, server finds the rest) and ids (also works across conversations), but this largely duplicates what the schema already states, adding little net-new meaning.

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 ('Reads a whole reply chain in one call') plus the distinguishing fold behavior. It explicitly names the sibling it replaces ('Use it instead of looping mail_get_message'), so an agent can separate it from mail_get_message without opening either schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use condition ('whenever you want two or more messages of one conversation') with concrete scenarios, names the alternative (mail_get_message loop), and explains the fallback path (narrow with mail_search_messages and pass ids) when the thread is too long.

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