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 marchFields: 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
andbetween 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
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | date | |
| query | Yes | ||
| max_results | No | ||
| newest_first | No | ||
| include_thread | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |