Skip to main content
Glama
mail-mcp

mail-mcp

search_messages

Read-only

Search email messages across accounts and folders by text, sender, recipient, subject, date, folder, or read status, returning newest headers first.

Instructions

Search messages; newest first. Returns headers only (use get_message for the body). Every message lists its sender-controlled fields in untrusted_fields; invisible and text-direction characters are removed from them (invisible_chars_removed appears when any were).

query: free text (IMAP TEXT, headers+body). from_addr/to_addr/subject: substring matches.
since/before: YYYY-MM-DD arrival date (IMAP INTERNALDATE; before is exclusive). unread: true=only unread, false=only read.
folder: name or alias (sent, drafts, trash, junk, archive, all). limit: 1-200 (above 200 is capped and noted, below 1 is an error).
gmail_query: Gmail search syntax (X-GM-RAW), Gmail accounts only.
account="all" searches every enabled account in parallel.

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": {
      "account": "<account>"
    },
    "name": "search_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
queryNo
sinceNo
beforeNo
folderNoINBOX
unreadNo
accountYes
subjectNo
to_addrNo
from_addrNo
gmail_queryNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Annotations only declare readOnlyHint and openWorldHint, but the description adds real behavioral context: truncated header-only results, the untrusted_fields wrapper for sender-controlled data, sanitization of invisible/text-direction characters with an invisible_chars_removed flag, limit capping above 200, and parallel fan-out for account="all". That is material disclosure well beyond the structured fields.

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

Conciseness5/5

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

Two front-loaded sentences establish purpose and return contract, followed by a compact per-parameter block. Every clause carries non-obvious information such as INTERNALDATE, exclusivity of before, and cap behavior; nothing is redundant.

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?

For an 11-parameter search tool with no output schema, the description covers purpose, return shape, sanitization, pagination/limit limits, and multi-account behavior. An agent has everything it needs to invoke this correctly without further exploration.

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%, so the description carries the full burden, and it documents every one of the 11 parameters with semantics the schema cannot express: query as IMAP TEXT over headers+body, substring matching for address/subject filters, YYYY-MM-DD INTERNALDATE for since/before, before being exclusive, unread's true/false asymmetry, folder aliases, the 1-200 limit range, and gmail_query being Gmail-only.

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 opening sentence gives a specific verb and resource ("Search messages"), states the ordering ("newest first") and the return shape ("headers only"), and explicitly routes body retrieval to the get_message sibling. An agent can distinguish this from get_message, get_thread, and list_folders without opening any schema.

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 names the alternative for full bodies (get_message) and gives the conditions that select each filter (query vs. from_addr/to_addr/subject vs. gmail_query) plus the account="all" fan-out. It stops short of explicit exclusions such as when to prefer get_thread or list_folders, so there is a small routing gap.

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