Skip to main content
Glama

Search emails

search_emails
Read-onlyIdempotent

Search one or more IMAP folders and return summaries in exactly the shape list_emails returns plus the folder each was found in, newest first - including the same preview of the first line or two, so a search usually answers the question without a read_email after it. Not message bodies, though; read_email is the tool for reading one message in full. SEARCH EVERY FOLDER THE MESSAGE COULD BE IN, IN ONE CALL: "where is that email from Bob" usually means INBOX and Sent, plus any archive folder list_mailboxes shows, and passing them all in mailboxes costs the user one call instead of several. A named folder the mailbox does not have is skipped and named in the result. Each result carries its own mailbox - pass that back when you act on it, because UIDs mean different messages in different folders. At least one criterion is required - an empty search is refused rather than silently returning the whole mailbox. from/to/cc/subject/body/text are SUBSTRING matches, not exact matches: searching from: "a@b.com" also matches "xa@b.commercial.example". since/before/on match the date the message was DELIVERED to this mailbox, not the sender's Date: header, and only at whole-day precision - the time of day is ignored. A result that had to be capped says so explicitly, together with the true total number of matches, so it is never mistaken for a complete list. select_emails, by contrast, returns up to 500 UIDs grouped by sender for a bulk action.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ccNoSubstring match against the Cc address or display name.
onNoDelivered on exactly this date (e.g. "2026-08-01"). Matches when the message arrived in this mailbox, not its Date: header.
toNoSubstring match against the To address or display name.
bodyNoSubstring match against the message body.
fromNoSubstring match against the From address or display name.
seenNoFilter by read/unread status.
textNoSubstring match against headers and body together.
limitNoHow many summaries to return, newest first. Defaults to 25.
sinceNoDelivered on or after this date (e.g. "2026-08-01"). Matches when the message arrived in this mailbox, not its Date: header. Whole-day precision only.
beforeNoDelivered before this date (e.g. "2026-08-01"). Matches when the message arrived in this mailbox, not its Date: header. Whole-day precision only.
flaggedNoFilter by the flagged/starred state.
subjectNoSubstring match against the subject line.
answeredNoFilter by whether the message has been answered.
mailboxesNoIMAP folders to search, e.g. ["INBOX", "Sent"], plus any archive folder list_mailboxes shows. Defaults to ["INBOX"]. Up to 25. Naming several here is ONE call; searching them one at a time is one call each.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / mailboxes / description
      Previous value: -"IMAP folders to search, e.g. [\"INBOX\", \"Archive\", \"Sent\"]. Defaults to [\"INBOX\"]. Up to 25. list_mailboxes gives the folder names. Naming several here is ONE call; searching them one at a time is one call each."New value: +"IMAP folders to search, e.g. [\"INBOX\", \"Sent\"], plus any archive folder list_mailboxes shows. Defaults to [\"INBOX\"]. Up to 25. Naming several here is ONE call; searching them one at a time is one call each."
  2. Changed1 schema field changed
    • changedInput schema / properties / mailboxes / description
      Previous value: -"IMAP folders to search, e.g. [\"INBOX\", \"Archive\", \"Sent\"]. Defaults to [\"INBOX\"]. Up to 25. Use list_mailboxes if you do not know the folder names. Naming several here is ONE call; searching them one at a time is one call each."New value: +"IMAP folders to search, e.g. [\"INBOX\", \"Archive\", \"Sent\"]. Defaults to [\"INBOX\"]. Up to 25. list_mailboxes gives the folder names. Naming several here is ONE call; searching them one at a time is one call each."
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations cover only the safety profile (read-only, idempotent, open world), and the description goes well beyond them: at-least-one-criterion enforcement, nonexistent folders skipped but named in the result, explicit cap disclosure with true total, per-result mailbox attribution because UIDs are folder-scoped, and delivered-date vs Date: header semantics.

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

Conciseness3/5

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

Front-loads the core purpose well, but it is long and repeats schema text near-verbatim, particularly the delivered-date/whole-day-precision caveat that already appears on `since`, `before`, and `on`, and the multi-folder batching advice that appears on `mailboxes`.

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?

No output schema exists, so the description carries the return contract itself: same shape as list_emails plus `mailbox`, a `preview` of the first line or two, and an explicit cap indicator with the true total. Nothing an agent needs to call it correctly is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real value the schema lacks: a concrete substring pitfall example ('from: "a@b.com" also matches "xa@b.commercial.example"') and the strategy of passing all plausible folders in one `mailboxes` argument rather than several calls.

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 (search) over a specific resource (IMAP folders) and pins the exact return shape ('summaries in exactly the shape list_emails returns plus the folder'), immediately separating it from read_email and select_emails by name.

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 explicit when-to-use guidance ('SEARCH EVERY FOLDER THE MESSAGE COULD BE IN, IN ONE CALL'), explicit when-not-to ('Not message bodies, though; read_email is the tool for reading one message in full'), and names select_emails as the alternative for bulk UID collection.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources