Skip to main content
Glama
email-mcp

email-mcp

by kerodkibatu

query_emails

Search and filter emails across all mail folders using MongoDB-style query filters on subject, sender, recipients, dates, unread status, attachments, and other fields.

Instructions

Query emails using a MongoDB-style filter tree. Searches across ALL mail folders by default (Inbox, Sent, Archive, custom, etc.).

FIELDS (queryable): subject, from, from_name, to, cc, body (slow, requires allow_slow=true), received, sent, unread, has_attachments, importance, size.

OPERATORS: $eq $ne $in $nin $contains $not_contains $starts_with $ends_with $gte $lte $gt $lt $exists. COMBINATORS: $and $or $not.

DATES: ISO format ("2026-01-25" or "2026-01-25T14:30").

DEFAULT FIELDS in response: small queries (limit <= 20) include entry_id; larger scans omit it for token efficiency. Override with the 'fields' param.

PATTERN: For broad searches, scan first with limit > 20 (no entry_ids), then re-query narrowly to get entry_ids for the specific items you want to act on (read/reply/mark).

EXAMPLE filter: { "$and": [ { "from": { "$in": ["a@x.com","b@x.com"] } }, { "subject": { "$contains": "report" } }, { "received": { "$gte": "2026-01-01" } } ]}

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "query_emails"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNoMax results (default 20, max 500)
fieldsNoOutput fields. Default depends on limit.
filterNoFilter tree. Empty {} matches all.
offsetNoPagination offset
accountNoAccount email (substring match). Default: all accounts.
order_byNoSort order
allow_slowNoRequired to query the body field

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations supplied, the description carries the full burden and does well: it discloses that body search is slow and requires allow_slow=true, explains response-field defaults and token-efficiency behavior, and notes that searches span all folders. It does not cover permissions, rate limits, or the full response shape, but the major behavioral gotchas are surfaced.

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 front-loaded with the core purpose and then uses clear headings for fields, operators, dates, defaults, pattern, and examples. It is longer than average but the structure makes it scannable, and the example earns its space.

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

Completeness4/5

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

For a relatively complex, nested-filter query tool with no output schema, the definition covers the essential syntax, defaults, performance caveats, and a usage pattern. Minor gaps remain around full response shape and pagination interaction, but an agent has enough to call it correctly.

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 already 100%, but the description adds substantial meaning beyond the schema by documenting queryable fields, supported operators and combinators, ISO date formats, default field inclusion tied to limit, and an example filter tree. This turns the opaque filter object into an actionable query language.

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 states a specific verb and resource: query emails using a MongoDB-style filter tree, and explicitly clarifies that it searches across ALL mail folders by default. This distinguishes it clearly from siblings like read_email, reply_email, and send_email.

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?

It gives strong contextual guidance, including the two-step pattern for broad scans and narrow re-queries for acting on specific messages, plus the requirement to use allow_slow for body searches. It stops short of explicitly naming sibling alternatives, but the operational guidance is clear.

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