Skip to main content
Glama
kojott

mailmcp

Search messages

search_messages
Read-onlyIdempotent

Search emails across multiple mail accounts using filters like sender, date, folder, read status, and full-text queries. Returns newest matches with identifiers for follow-up actions.

Instructions

Searches one account (or all accounts with account="all"). On Gmail, query accepts full Gmail search syntax (from:, newer_than:7d, has:attachment, label:, "exact phrase"). Elsewhere query is full-text and the structured filters do the rest. Returns newest first with uid + folder needed by other tools. On Outlook mailboxes total is the number of results returned, not a mailbox-wide count. On Outlook mailboxes from matches the exact address; use query for a partial match.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toNo
fromNo
limitNoDefault 20, max 50
queryNoGmail search syntax on Gmail; plain text elsewhere
sinceNoISO date, e.g. 2026-09-01
beforeNoISO date
folderNoFolder/label path. Defaults to All Mail on Gmail, INBOX elsewhere.
offsetNoSkip this many hits; the window Graph and IMAP fetch grows with it, so keep it small
unseenNoOnly unread
accountYesAccount id, or "all" to search every readable account
flaggedNoOnly starred/flagged
subjectNo
has_attachmentNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.8.1
    • addedInput schema / properties / offset / description
      Added value: +"Skip this many hits; the window Graph and IMAP fetch grows with it, so keep it small"
    • changedInput schema / properties / offset / maximum
      Previous value: -9007199254740991New value: +5000
  2. First observedv0.1.0

TDQS

A4.2/5.0
Behavior5/5

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

Annotations already declare this as read-only, idempotent, and non-destructive, so the description only needs to add behavioral context beyond safety. It adds strongest-first ordering, the uid+folder contract needed by downstream tools, and two important Outlook result semantics. No contradiction with annotations.

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 compact and front-loaded: scope, query syntax, return contract, then Outlook caveats. Every sentence contributes, with only slight redundancy in the two Outlook clauses. It is dense but not bloated.

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 13-parameter read-only search tool with no output schema, this covers the essential call semantics: account scope, query syntax, ordering, and return fields. The schema supplies defaults like folder and limit, so the remaining gaps are minor and unlikely to cause misinvocation.

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

Parameters4/5

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

The schema already documents most parameters, and the description adds meaning for the highest-ambiguity ones: query syntax on Gmail, account='all', and Outlook's exact vs. partial 'from' matching. Self-explanatory parameters like 'to' and 'subject' need no extra elaboration, though a few interactions are left implicit.

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?

Clearly states it searches messages, with scope controlled by account (one or all). The Gmail-vs-elsewhere query behavior and 'uid + folder needed by other tools' make it specific. It does not explicitly contrast itself with the sibling 'search' tool, so differentiation from siblings is incomplete.

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 when-to-use guidance by platform: full Gmail syntax on Gmail, full-text plus structured filters elsewhere, and account='all' for searching every readable account. It also explains Outlook-specific matching behavior for 'from'. It stops short of naming alternative tools or exclusion scenarios, so it is not fully explicit.

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