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. Looking for mail from or to a person is fastest with from or to, plus since when you know roughly when: the server answers those from its index. text and body make many servers read every message in each folder named, which on a large mailbox takes several seconds a folder. select_emails, by contrast, returns up to 500 UIDs grouped by sender for a bulk action.

Input 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.8/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnly, idempotent, non-destructive), yet the description adds substantial context they cannot: substring rather than exact matching with a concrete false-positive example, delivered-date rather than Date: header matching at whole-day precision, missing folders being skipped and named, capped results reporting the true total, and per-result UIDs being folder-scoped. This is unusually rich behavioral disclosure.

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 return shape, then usage guidance, then semantics, then performance — a sensible ordering. It is dense and long, and the delivered-date rule is restated in the description after already appearing on three schema properties, which is mild redundancy.

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?

For a 14-parameter tool with no output schema, the description tells the agent what comes back (list_emails-shaped summaries plus `mailbox`), how results are ordered, how truncation is signalled, and how to carry folder identity forward to subsequent calls. Nothing an agent needs to invoke 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 genuinely adds meaning: the substring semantics with the "xa@b.commercial.example" example, the delivered-date semantics for since/before/on, and the performance implication that text/body force full-message scans while from/to hit a server index. It stops short of explaining limit/seen/flagged/answered, though the schema covers those adequately.

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?

The opening clause states a specific verb (Search) and resource (IMAP folders / emails) and pins the return contract: summaries in the same shape as list_emails plus a `mailbox` field, newest first. It explicitly distinguishes itself from read_email (bodies), select_emails (bulk UIDs by sender), and list_mailboxes (folder discovery).

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?

It states when to use this tool, when not to (reading a full message is read_email; bulk actions are select_emails), and gives a concrete decision heuristic for the multi-folder case ("where is that email from Bob" means INBOX + Sent + archives in one call). It also explains the cost tradeoff between from/to and text/body.

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