Skip to main content
Glama

Search Emails

search_emails
Read-onlyIdempotent

Search emails by subject, body, or sender across mailbox folders. Supports caching and optional folder filtering for personal or work accounts.

Instructions

📖 Search emails across mailbox (read-only, safe for unsupervised use)

Searches email subject, body, and sender across all or specific folders. Automatically routes to the appropriate API based on account type:

  • Personal accounts: Uses OData $search parameter

  • Work/school accounts: Uses unified search API

Args: query: Search query string (1-512 characters) account_id: Microsoft account ID limit: Maximum results to return (1-500, default: 50) folder: Optional folder to search within (e.g., "inbox", "sent") use_cache: Whether to use cache (default: True) force_refresh: Bypass cache and fetch fresh data (default: False)

Returns: List of matching emails with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
account_idYes
limitNo
folderNo
use_cacheNo
force_refreshNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

Description goes beyond annotations by detailing automatic routing, caching behavior (use_cache, force_refresh), and return type. It reinforces the readOnlyHint and adds operational context, without contradicting annotations.

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?

Description is well-structured with sections and bullet points, but includes an emoji and slightly verbose phrasing (e.g., '📖 Search emails across mailbox (read-only, safe for unsupervised use)'). Still, it remains efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers purpose, parameters, routing, caching, and safety. With an output schema present, it doesn't need to detail return format. Missing details on pagination or handling large result sets, but overall sufficient for a search tool.

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?

Schema has zero parameter descriptions, but the tool description compensates thoroughly, explaining each parameter's purpose, constraints (e.g., query length, limit range), defaults, and examples (e.g., folder options). This provides essential semantic information for correct invocation.

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 states the tool's function: search emails across mailbox with specific scope (subject, body, sender). It differentiates from siblings like email_list, email_get, and other search tools by emphasizing the search capability and automatic API routing based on account type.

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 explicitly says it's read-only and safe for unsupervised use, providing clear context for when to use. However, it does not mention alternatives like search_unified or when not to use this tool, which would improve guidance.

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/robin-collins/m365-mcp'

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