Skip to main content
Glama

imap_search_messages

Search messages with cursor pagination

Instructions

Search messages with cursor pagination

Input Schema

NameRequiredDescriptionDefault
toNoFilter by To header
fromNoFilter by From header
limitNoMaximum messages to return (1..50, default 10)
queryNoFull-text search query
cursorNoPagination cursor from previous search result
mailboxYesMailbox to search (e.g., `INBOX`, `Sent`, `Archive`)
subjectNoFilter by Subject header
end_dateNoFilter to messages before this date (YYYY-MM-DD)
last_daysNoFilter to messages from last N days
account_idNoAccount identifier (defaults to `"default"`)default
start_dateNoFilter to messages on or after this date (YYYY-MM-DD)
unread_onlyNoFilter to unread messages only
include_snippetNoInclude subject snippet in results
snippet_max_charsNoMaximum snippet length (50..500, requires `include_snippet=true`)
thread_message_idNoFind a conversation by its RFC 5322 Message-ID (angle brackets optional): matches the message itself and every message whose In-Reply-To or References header carries it, i.e. the replies in this mailbox

Output Schema

NameRequiredDescriptionDefault
dataYesTool-specific data payload
metaYesExecution metadata (timestamp, duration)
summaryYesHuman-readable summary of the operation outcome

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.4.17
    • addedInput schema / properties / thread_message_id
      Added value: +{
      +  "description": "Find a conversation by its RFC 5322 Message-ID (angle brackets optional):\nmatches the message itself and every message whose In-Reply-To or\nReferences header carries it, i.e. the replies in this mailbox",
      +  "nullable": true,
      +  "type": "string"
      +}
  2. First observedv0.4.12

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden. It mentions cursor pagination, which is genuinely useful context, but says nothing about read-only semantics, result limits, how cursors are threaded across calls, or typical latency/cost.

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?

A single front-loaded sentence with zero wasted words. It is arguably too terse for a 15-parameter search tool, but nothing in it is filler.

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

Completeness3/5

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

An output schema exists, so return format need not be explained, and the schema fully documents parameters. Still, for a multi-criteria search tool with four sibling search variants, the description omits filtering capability and cursor flow detail that would help an agent invoke it correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so all 15 parameters (from/to/subject/query/date filters, limit, cursor, snippet options) are already documented in the schema. The description adds no parameter meaning beyond that, which lands at the baseline 3.

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

Purpose4/5

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

States a clear verb+resource ('Search messages'), which an agent can understand immediately. However, it does nothing to distinguish itself from siblings like ews_search_messages, imap_search_all_mailboxes, imap_search_and_delete, and imap_search_and_move, so scope boundaries are left to inference.

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

Usage Guidelines2/5

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

The description gives no when-to-use guidance, no prerequisites, and no mention of when a sibling search tool is preferable. It only notes the pagination style, which is a property of the tool rather than usage direction.

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