Skip to main content
Glama
hajekd
by hajekd

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

TableJSON Schema
NameRequiredDescriptionDefault
skipNo
takeNo
userNo
queueNo
date_toNo
questionNoFlag emails needing management attention: angry customers, escalation requests, compliance issues, lost deals, missed commitments, unresolved complaints.
date_fromYes
directionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so thoroughly. It discloses processing time ('this analysis takes some time because it processes each email with AI'), pagination behavior ('Returns one page', 'you MUST scan ALL pages'), the unreliability of partial analysis ('partial analysis gives unreliable results'), and mandates parallel calls for remaining pages. It even instructs the agent to warn the user, which is a behavioral trait.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with bolded warnings and paragraphs, but it is lengthy and contains some redundancy: the 'IMPORTANT' user-warning note appears both at the beginning and within the 'CRITICAL' section, and the pagination message is repeated twice. Still, most text earns its place given the genuine complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description goes beyond it by explaining the return type ('compact ranked list with scores, flags, and summaries'), full pagination rules, parameter semantics, and the intended workflow with get_email. No significant gaps remain given the tool's complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description's Args section explains every parameter with formats, defaults, and examples (e.g., date_from: 'Start date (YYYY-MM-DD). Required.', take: 'Number of emails to score in this page (default: 100, max: 200)'). It also elaborates on skip/take with a pagination example, compensating fully for the schema's lack of descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with 'AI-score emails in a date range. Returns one page of scored results.' which clearly states the verb (AI-score), resource (emails), and scope (date range). It also distinguishes itself from siblings by mentioning 'After reviewing scored results, use get_email to read the full email content,' positioning scan_emails as a pre-filtering tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear usage context: it is for AI-scoring emails in a date range, with a 'question' parameter to specify what to flag, and recommends using get_email afterwards. However, it does not explicitly state when not to use it or compare to alternatives like list_emails or scan_calls, so it falls short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hajekd/mcp-daktela'

If you have feedback or need assistance with the MCP directory API, please join our Discord server