Skip to main content
Glama

imap_search_messages

Read-onlyIdempotent

Search IMAP mailbox messages by sender, recipient, subject, date, unread status, or full-text query, with cursor pagination to retrieve results in manageable batches.

Instructions

Search messages with cursor pagination

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "mailbox": "<mailbox>"
    },
    "name": "imap_search_messages"
  }
}

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.7/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=true, so the safety profile is fully covered. The description adds only that results are cursor-paginated, which is largely redundant with the `cursor` parameter documentation in the schema; nothing is said about result ordering, page sizes, or search cost across mailboxes.

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

Conciseness3/5

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

At eight words it is lean and front-loaded with the verb+resource, so nothing is wasted. But the brevity is under-specification rather than discipline: the entire definition is a single clause with no guidance, alternatives, or caveats for a 15-parameter tool.

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?

An output schema exists and the input schema is fully documented, so the description need not explain return values or parameter formats, which limits the burden considerably. The remaining gap is sibling disambiguation in a crowded search toolset, which the description completely omits.

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% across 15 parameters, and the schema itself explains the filters, date formats, snippet options, and the RFC 5322 thread lookup. The description contributes no meaning beyond that, so it earns the baseline of 3 rather than more.

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

Purpose3/5

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

The description gives a specific verb and resource ("Search messages") plus a delivery trait (cursor pagination), so the basic operation is clear. However, it does not distinguish this from near-identical siblings such as `imap_search_all_mailboxes` or `ews_search_messages`, so an agent must open schemas to choose correctly.

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?

There is no when-to-use guidance at all: no mention of when to prefer this over `imap_search_all_mailboxes`, the EWS/Graph equivalents, or the search-and-mutate variants (`imap_search_and_delete`, `imap_search_and_move`). The only implicit hint is the cursor-pagination phrase, which is a mechanism, not usage guidance.

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