search_emails
Search emails using filter syntax for subject, sender, body, date, and flags. Combine conditions with and/or, negate with not, and sort results with order by.
Instructions
Search emails using himalaya filter syntax. Combine conditions with and/or (REQUIRED between every condition pair — omitting them causes parse errors). Negate any condition with not. Multi-word values need backslash-escaped spaces. Bare words default to subject-only search. Sort results with order by <date|from|to|subject> <asc|desc>. Conditions: subject, from, to, body, date (exact match), before, after, flag. Flag values: Seen, Flagged, Answered, Deleted, Draft.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | Search query. Use `and`/`or` between every condition pair (e.g. 'from alice and after 2026-07-01'; NOT 'from alice after 2026-07-01'). Negate with `not` (e.g. 'not from spammer', 'not body spam'). Multi-word values: backslash-escape spaces ('subject quarterly\ report'). Bare words default to subject search; use 'body <word>' for body text. Sort with 'order by date desc', 'order by subject asc', etc. Full example: 'subject invoice and after 2026-01-01 order by date desc'. | |
| folder | No | Folder to search in (default: INBOX) | |
| account | No | Account name (uses default if omitted) |