Skip to main content
Glama

search_emails

Search the local email index with mu queries to find messages by sender, subject, body, date, tags, flags, or attachments, returning paths for viewing or attachment access.

Instructions

Search the local mail index with a mu query.

Returns one line per message: date | from | subject | path. Pass the path to view_emails or list_attachments.

Query syntax (quote phrases with double quotes; no shell is involved):

  • Bare words search from/to/cc/subject/body: invoice march

  • Fields: from: to: cc: contact: (any address) subject: body: maildir: (e.g. maildir:/Inbox) list: tag: file: (attachment name) mime: (attachment type, e.g. mime:application/pdf, mime:image/*)

  • Dates: date:2024-04..2024-04, date:2w.. (last 2 weeks), date:..2023, date:today.. (units: h d w m y)

  • Flags: flag:attach flag:unread flag:flagged flag:replied flag:personal flag:list flag:calendar

  • Operators: and, or, not, parentheses; implicit and between terms.

  • Wildcard suffix: budg*. Regex: subject:/re.?port/

  • Names match words in the address too: from:alice, from:amazon

Examples:

  • from:alice date:1w..

  • subject:"meeting notes"

  • mime:application/pdf and date:2025-04..2025-04

  • (from:bank or from:visa) and flag:unread

  • contact:bob and not flag:list

Args: query: the mu query. max_results: cap on returned messages; raise it or narrow the query if the result is cut off. sort: field to sort by. newest_first: reverse sort order (newest/Z first). include_thread: also return other messages from matching threads.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortNodate
queryYes
max_resultsNo
newest_firstNo
include_threadNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.6.1

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and does disclose key behavior: the exact one-line-per-message return format, the fact that max_results truncation is possible and how to react ('raise it or narrow the query if the result is cut off'), and the semantics of newest_first ('newest/Z first'). It never explicitly states read-only/no-side-effect behavior, but search semantics imply it.

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

Conciseness5/5

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

Long but dense: purpose and return format are front-loaded, then the query grammar is organized under tight bullet headings with examples. Every block is load-bearing for a tool whose parameter is a mini-language; nothing reads as filler.

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?

An output schema exists, yet the description still front-loads the return line format, and all five parameters, the query grammar, and the follow-up tools are covered. For a search tool of this complexity, an agent has everything needed to construct a correct call.

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 description coverage is 0%, so the description must compensate, and it documents all five parameters: query (with a full grammar and examples), max_results (a cap plus the truncation remedy), sort (field to sort by), newest_first (reverse order), and include_thread (also return other messages from matching threads). This is meaningfully more than the bare schema types/defaults.

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 ('Search the local mail index with a `mu` query') and immediately clarifies the exact return shape (`date | from | subject | path`). It also names the sibling tools that consume the output (view_emails, list_attachments), so an agent can place it in the workflow without opening any schema.

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?

Gives extensive guidance on how to use it (full query grammar, field list, date units, flag list, operators, five concrete examples) and how to chain it to siblings via the returned path. It does not explicitly state when to prefer it over mu_help or when a narrower query is required beyond the truncation note, so it stops short of a full when/when-not statement.

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