Skip to main content
Glama

Search Emails

search_emails
Read-only

Use this when the user wants to find specific emails on this Mac (Apple Mail — any account added to Mail.app). Searches subject and sender by default; pass scope="body" or scope="all" to also search the message body (see search_coverage in the response — a body search can be partial while its local index is still building). Trash and junk folders are left out unless include_trash=true or mailbox names one. For a Microsoft 365 mailbox NOT added to Mail.app, use m365_search_emails.

IMPORTANT: on machines with 2+ accounts, call with account= (from list_email_accounts). Without it, and when the fast index can't answer, search_emails returns the account list instead of scanning all of them — scanning every account in one call has no time limit and can block Mail for other requests too. Exactly 1 account is unaffected.

Input Schema

NameRequiredDescriptionDefault
limitNoMaximum number of matches to return.20
queryYesWhat to look for. Matched against subject and sender, or also the body when scope is "body" or "all".
scopeNo"metadata" (default, subject+sender — fast, unchanged behavior), "body" (message body only, via a local index — see search_coverage in the response), or "all" (subject+sender+body).metadata
accountNoMail.app account to search (from list_email_accounts). On a Mac with 2+ accounts this is effectively required: without it, and when the fast index cannot answer, the tool returns the account list instead of scanning them all.
mailboxNoRestrict the search to one folder, by name (see list_email_folders). Defaults to every folder of the account.
recipientNoOnly messages sent to this address or name (To or Cc), e.g. one of the user's own aliases. Narrows the matches of query.
include_trashNoAlso return matches from trash and junk folders. Default false: a search of every folder leaves them out. Not needed when mailbox names the folder.false

Output Schema

NameRequiredDescriptionDefault
countNo
queryNo
resultsNo
warningsNo
next_actionsNo
search_scopeNo
search_backendNo
search_coverageNo
search_fallbackNo"metadata" when a body search couldn't answer and the results come from a subject/sender search of the same query.
omitted_mailboxesNo
search_fallback_noteNo
search_fallback_reasonNoWhy the body search didn't answer, e.g. body_query_failed or body_index_not_built_yet.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changed
    • addedInput schema / properties / include_trash
      Added value: +{
      +  "default": "false",
      +  "description": "Also return matches from trash and junk folders. Default false: a search of every folder leaves them out. Not needed when mailbox names the folder.",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / recipient
      Added value: +{
      +  "description": "Only messages sent to this address or name (To or Cc), e.g. one of the user's own aliases. Narrows the matches of query.",
      +  "type": "string"
      +}
  2. Changed6 schema fields changed
    • addedOutput schema / properties / next_actions / items
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / omitted_mailboxes / items
      Added value: +{
      +  "type": "object"
      +}
    • addedOutput schema / properties / search_fallback
      Added value: +{
      +  "description": "\"metadata\" when a body search couldn't answer and the results come from a subject/sender search of the same query.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / search_fallback_note
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / search_fallback_reason
      Added value: +{
      +  "description": "Why the body search didn't answer, e.g. body_query_failed or body_index_not_built_yet.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / warnings / items
      Added value: +{
      +  "type": "string"
      +}
  3. Changed4 schema fields changed
    • addedInput schema / properties / account / description
      Added value: +"Mail.app account to search (from list_email_accounts). On a Mac with 2+ accounts this is effectively required: without it, and when the fast index cannot answer, the tool returns the account list instead of scanning them all."
    • addedInput schema / properties / limit / description
      Added value: +"Maximum number of matches to return."
    • addedInput schema / properties / mailbox / description
      Added value: +"Restrict the search to one folder, by name (see list_email_folders). Defaults to every folder of the account."
    • addedInput schema / properties / query / description
      Added value: +"What to look for. Matched against subject and sender, or also the body when scope is \"body\" or \"all\"."
  4. Changed4 schema fields changed
    • removedInput schema / properties / account / description
      Removed value: -"Mail.app account to search (from list_email_accounts). On a Mac with 2+ accounts this is effectively required: without it, and when the fast index cannot answer, the tool returns the account list instead of scanning them all."
    • removedInput schema / properties / limit / description
      Removed value: -"Maximum number of matches to return."
    • removedInput schema / properties / mailbox / description
      Removed value: -"Restrict the search to one folder, by name (see list_email_folders). Defaults to every folder of the account."
    • removedInput schema / properties / query / description
      Removed value: -"What to look for. Matched against subject and sender, or also the body when scope is \"body\" or \"all\"."
  5. Changed4 schema fields changed
    • addedInput schema / properties / account / description
      Added value: +"Mail.app account to search (from list_email_accounts). On a Mac with 2+ accounts this is effectively required: without it, and when the fast index cannot answer, the tool returns the account list instead of scanning them all."
    • addedInput schema / properties / limit / description
      Added value: +"Maximum number of matches to return."
    • addedInput schema / properties / mailbox / description
      Added value: +"Restrict the search to one folder, by name (see list_email_folders). Defaults to every folder of the account."
    • addedInput schema / properties / query / description
      Added value: +"What to look for. Matched against subject and sender, or also the body when scope is \"body\" or \"all\"."
  6. Changed6 schema fields changed
    • addedInput schema / properties / scope
      Added value: +{
      +  "default": "metadata",
      +  "description": "\"metadata\" (default, subject+sender — fast, unchanged behavior), \"body\" (message body only, via a local index — see search_coverage in the response), or \"all\" (subject+sender+body).",
      +  "type": "string"
      +}
    • addedOutput schema / properties / omitted_mailboxes
      Added value: +{
      +  "type": "array"
      +}
    • addedOutput schema / properties / search_backend
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / search_coverage
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / search_scope
      Added value: +{
      +  "type": "string"
      +}
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "type": "array"
      +}
  7. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare a safe read, but the description discloses real behavioral traits: body search can be partial while the local index builds, and on multi-account machines an omitted account causes the tool to return an account list instead of scanning, because scanning every account has no time limit and can block Mail for other requests. That is exactly the kind of non-obvious behavior an agent cannot get from the schema.

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 the when-to-use case, then defaults, then the IMPORTANT account caveat at the end where it is most likely to be re-read. It is dense but every sentence carries operational weight; the only mild cost is length for a single tool.

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 an output schema present the description need not explain return values, and it does the remaining work: defaults, folder exclusions, index-coverage caveat, multi-account fallback, and the sibling tool for M365. 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 baseline is 3, but the description goes beyond the schema on the riskiest parameter: it explains that account is 'effectively required' on 2+ account machines and what happens if it is omitted, and it qualifies what scope='body' means in terms of index freshness. It does not add much on limit/recipient beyond the schema.

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 plus a precise scope: 'find specific emails on this Mac (Apple Mail — any account added to Mail.app)'. That scoping lets an agent separate it from m365_search_emails, thunderbird_search_emails, proton_search_emails and list_emails without opening the 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 explicit when-to-use ('user wants to find specific emails'), an explicit alternative and the condition that selects it ('Microsoft 365 mailbox NOT added to Mail.app → m365_search_emails'), and a prerequisite ('call with account=<name> from list_email_accounts' on 2+ account machines). Exclusions (trash/junk) are also stated.

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