Search Mail
searchMessagesSearch message headers across Thunderbird accounts by sender, recipient, subject, date, tags, or keywords; optionally full-text search bodies and group results by sender or thread.
Instructions
Search message headers across accounts (Trash/Junk skipped); for the latest mail with no query, getRecentMessages. Returns { messages, totalMatches, offset, limit, hasMore }; each row has id + folderPath for getMessage/getMessages. For a company use query 'participant:@domain' with groupBy.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tag | No | Tag label or key (e.g. 'Important' or '$label1') | |
| query | Yes | Words that must all match (subject, from, to, cc, preview). Operators: from:, to:, cc:, subject:, participant: (from/to/cc/bcc; '@domain' = addresses in that domain, commas = any of them: 'participant:@a.com,@b.com'); quote phrases, e.g. 'participant:@acme.com subject:"invoice 42"'. A single leading operator applies to all words ('from:Alice Smith'). Empty string matches all. | |
| fields | No | Only these row columns (id, folderPath and option columns always); not with countOnly, groupBy or legacy | |
| format | No | 'table': messages as { columns, rows }, fewer tokens. 'legacy' (deprecated): the 0.10 output, a plain array of full rows unless offset is passed; not with groupBy | |
| offset | No | Rows to skip; use with hasMore | |
| endDate | No | ISO 8601 date: on or before; date-only includes the whole day | |
| groupBy | No | Collapse matches into one row per sender or conversation: count, unread, first/last date, latestId + latestFolderPath of the newest non-draft message, drafts count | |
| threadOf | No | The whole conversation of this message across folders (Sent included), oldest first; a Re: without threading headers joins by subject the earlier message its sender took part in (linkedBy: subject). Reads 10,000 headers at most, else incomplete: true (narrow with folderPath) | |
| countOnly | No | Return only { count } | |
| sortOrder | No | By date; default desc, asc with threadOf | |
| startDate | No | ISO 8601 date: on or after | |
| folderPath | No | Folder URI (from listFolders) to search, with subfolders | |
| maxResults | No | Rows (or groups) per page | |
| searchBody | No | Full-text search of subject, body and attachment names via the Gloda index (slower): words or "quoted phrases", all must match, no operators; terms under 3 characters are ignored; English matches other word forms, other languages only the exact form. IMAP needs offline sync. | |
| unreadOnly | No | Only unread | |
| flaggedOnly | No | Only flagged/starred | |
| includeTrash | No | Also search Trash and Junk | |
| attachmentName | No | Only messages with an attachment whose filename contains this (any case); rows list them | |
| attachmentType | No | Same for a MIME type or prefix ('application/pdf', 'image/'). Reads local copies, 500 at most; attachmentSearch counts skipped ones | |
| dedupByMessageId | No | Collapse copies of one message in several folders into one row with dupLocations | |
| includeSubfolders | No | Search subfolders of folderPath |