Skip to main content
Glama

search_emails

Unified email search across accounts and mailboxes with filters for subject, sender, body, attachments, read status, and date range. Supports pagination and JSON or text output.

Instructions

Unified search tool with JSON output, pagination, and real date filtering.

Consolidates subject search, sender search, body content search, and cross-account search into a single tool.

Args: account: Account name to search in (e.g., "Gmail", "Work"). If None, searches ALL accounts (slower). mailbox: Mailbox to search (default: "INBOX", use "All" for all mailboxes, or specific folder name) subject_keyword: Optional keyword to search in subject subject_keywords: Optional list of subject keywords; matches any keyword sender: Optional sender email or name to filter by has_attachments: Optional filter for emails with attachments (True/False/None) read_status: Filter by read status: "all", "read", "unread" (default: "all") date_from: Optional start date filter (format: "YYYY-MM-DD") date_to: Optional end date filter (format: "YYYY-MM-DD") include_content: Whether to include email content preview (slower) max_content_length: Maximum content length in characters when include_content=True (default: 500, 0 = unlimited) body_text: Optional text to search for in email body content (case-insensitive). WARNING: body search is significantly slower as it reads each message body. max_results: Backward-compatible alias for limit output_format: Output format: "text" or "json" (default: "text") offset: Number of matching results to skip before returning data limit: Maximum number of results to return per page sort: Result sort order: "date_desc" or "date_asc"

Returns: Formatted list of matching emails or JSON payload with stable message metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountNo
mailboxNoINBOX
subject_keywordNo
subject_keywordsNo
senderNo
has_attachmentsNo
read_statusNoall
date_fromNo
date_toNo
include_contentNo
max_content_lengthNo
body_textNo
max_resultsNo
output_formatNotext
offsetNo
limitNo
sortNodate_desc

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses that the tool consolidates multiple search types, supports pagination and date filtering, includes a warning about body text search being slower, and mentions output format options. It does not mention idempotency or side effects (likely read-only), but overall is transparent.

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?

The description is well-structured with a concise introductory sentence followed by a detailed parameter list. It is front-loaded with key capabilities. However, it is relatively lengthy due to the number of parameters, but every sentence adds value. Could be slightly more compact, but still effective.

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?

Given the high parameter count (17) and no annotations, the description covers all necessary context: parameter behavior, performance trade-offs, output format options, and pagination. The presence of an output schema likely handles return value documentation. The description is complete and leaves no major gaps.

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

Parameters5/5

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

The description adds significant value beyond the bare input schema (which has no descriptions). Each parameter is explained with usage notes, defaults, and warnings (e.g., account: 'searches ALL accounts (slower)', body_text: 'significantly slower'). It clarifies optionality and behavior, fully compensating for the 0% schema coverage.

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 description clearly identifies the tool as a unified email search with JSON output, pagination, and real date filtering. It distinguishes itself from sibling tools like list_inbox_emails (which likely lists without search) and get_email_thread (which retrieves a specific thread). The verb 'search' is implied and the resource 'emails' is specified.

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

Usage Guidelines4/5

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

The description explains when to use this tool: for searching emails with filters like subject, sender, body text, etc. It provides performance warnings for body search and search across all accounts. However, it does not explicitly state when not to use it or list alternatives like list_inbox_emails for simple listing.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/patrickfreyer/apple-mail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server