Skip to content

feat(search): add since/before/include_body params to search_emails#1

Open
harcek wants to merge 1 commit into
fix/coerce-paramsfrom
feat/search-controls
Open

feat(search): add since/before/include_body params to search_emails#1
harcek wants to merge 1 commit into
fix/coerce-paramsfrom
feat/search-controls

Conversation

@harcek

@harcek harcek commented Apr 26, 2026

Copy link
Copy Markdown
Owner

The upstream implementation always included { body: query } in the OR criteria. On large mailboxes this causes IMAP body scans to time out.

Changes:

  • Body search is now opt-in via include_body (default false). Without it, only subject and sender are searched — fast on any mailbox size.
  • When include_body=true and no since is provided, a 90-day window is automatically applied to bound the scan.
  • New since and before params (ISO 8601) for explicit date filtering on all searches.
  • Fixed orFields type from union to Record<string, string>[] to satisfy TypeScript strict mode.

Depends on codefuturist#28.

Tested against Gmail and other IMAP providers. No regressions on existing tools.

- since/before: date filters passed directly to IMAP server for efficiency
- include_body: body search is now opt-in (default: subject+sender only)
  Body search is expensive on large mailboxes; when enabled without a
  since date, automatically constrains to the last 90 days to prevent timeouts
- orFields typed as Record<string, string>[] to fix TS union type error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant