Table of Contents

Method SearchEmailsAsync

Namespace
MailFathom.Application.Emails.SearchEmails
Assembly
MailFathom.Application.dll

SearchEmailsAsync(SearchEmailsRequest, CancellationToken)

Searches for one window of ranked emails and publishes it to a caller outside this process.

public Task<SearchEmailsResult> SearchEmailsAsync(SearchEmailsRequest request, CancellationToken cancellationToken)

Parameters

request SearchEmailsRequest

What the caller asked for.

cancellationToken CancellationToken

Propagates caller cancellation.

Returns

Task<SearchEmailsResult>

The ranked window, how it was ranked, and the scope's synchronization freshness.

Remarks

The guard belongs to publishing rather than to searching, which is why it is here and not in SearchWindowAsync(SearchEmailsRequest, CancellationToken): this window becomes an MCP tool's answer, while the one that method returns is read inside the process by something that guards it at its own egress point.

The span is reported around the same boundary and for the same reason. What it has to measure is what an MCP caller waited for, which includes the scan of everything the window publishes; a span around the ranking alone would report a fast search on a deployment whose reads are slow because they are being scanned. The retrieval an answering run makes is reported by that run's own span instead, so the two do not report the same work twice.

Exceptions

ArgumentNullException

Thrown when request is null.

MailboxQueryFilterInvalidException

Thrown when the query text is blank or unusable, or a structured filter carries a value, a count, or a length the query does not accept.

MailAccountNotAccessibleException

Thrown when the request names an account this deployment does not serve.

EmailSearchResultLimitOutOfRangeException

Thrown when the request names a result count outside the accepted range.

SensitiveContentScannerUnavailableException

Thrown when a switched-on scanner could not establish what the window carries, which refuses the search rather than serving it unscanned.