scan_emails
Scan emails in a date range, AI-score each message, and get a ranked list of flagged issues like escalations or complaints. Paginate through all results to catch every critical item.
Instructions
AI-score emails in a date range. Returns one page of scored results.
IMPORTANT: Before calling this tool, briefly tell the user that this analysis takes some time because it processes each email with AI (e.g. "Let me analyze your emails — this involves AI-scoring each one, so it may take a moment.").
Fetches a page of emails (default 100), scores each with a fast AI model using the email subject and body, and returns a compact ranked list with scores, flags, and summaries.
CRITICAL — you MUST scan ALL pages. The first 100 results are NOT representative of the full dataset. Important issues may appear in any page. If the response shows remaining records, you MUST call all remaining pages (in parallel) before presenting results. Never skip pages or stop early — partial analysis gives unreliable results.
Pagination: Each call returns up to take scored records and reports the total.
If total > take, call ALL remaining pages IN PARALLEL:
First call: scan_emails(date_from='2026-02-20') → returns 100 scored + "500 total"
Then IN PARALLEL: scan_emails(..., skip=100), scan_emails(..., skip=200), etc.
After reviewing scored results, use get_email to read the full email content of specific flagged items.
Args: date_from: Start date (YYYY-MM-DD). Required. date_to: End date (YYYY-MM-DD). Defaults to same as date_from (single day). user: Agent name — display name or login name, resolved automatically. queue: Queue internal name (e.g. '10333'). direction: Filter by direction: 'in' (incoming) or 'out' (outgoing). question: What to analyze for. Be specific about what to flag. skip: Pagination offset (default: 0). Use to fetch subsequent pages. take: Number of emails to score in this page (default: 100, max: 200).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| skip | No | ||
| take | No | ||
| user | No | ||
| queue | No | ||
| date_to | No | ||
| question | No | Flag emails needing management attention: angry customers, escalation requests, compliance issues, lost deals, missed commitments, unresolved complaints. | |
| date_from | Yes | ||
| direction | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |