Skip to main content
Glama

Search AgentMail messages

search_agentmail_messages
Read-only

Find messages in an AgentMail inbox and return their metadata (id, thread, sender, recipients, subject, date, preview, labels) — not full bodies. With query, a full-text search of sender, recipients, subject and body, best match first. Without it, the newest messages, optionally filtered by labels and by from/to/subject substrings. Then read one with get_agentmail_message, or file it with update_agentmail_labels. Trashed and spam messages are skipped unless asked for.

Input Schema

NameRequiredDescriptionDefault
toNoA recipient contains this text
fromNoSender contains this text
afterNoOnly messages after this time (ISO 8601)
limitNoMax results (default 20, cap 100)
queryNoFull-text search; when given, labels/from/to/subject are ignored
beforeNoOnly messages before this time (ISO 8601)
labelsNoOnly messages carrying all of these labels, e.g. ["unread"]
mailboxYesAddress of the connected AgentMail inbox to act on. Call list_authorized_mailboxes to see available options.
subjectNoSubject contains this text
pageTokenNonextPageToken from the previous call, for the next page
includeSpamNo
includeTrashNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and non-destructive, so the safety profile is covered. The description adds genuinely useful behavior beyond annotations: metadata-only returns, result ordering (best match first vs newest), and that trashed/spam messages are skipped unless requested. It doesn't mention pagination behavior or the limit cap, which are minor gaps.

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?

Front-loaded with the core action and return scope, then modes, then follow-ups. Efficient and well-structured. Slightly dense with four ideas packed into few sentences, but every clause earns its place.

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 12-param, metadata-only search tool with no output schema, the description covers return scope, modes, exclusions, and follow-ups well. The only omissions are pagination and result-cap guidance, which are documented in the schema parameters pageToken and limit.

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?

Schema coverage is high (83%), so the schema carries most parameter detail. The description still adds valuable semantics beyond the schema: the precedence rule that `query` causes labels/from/to/subject to be ignored, and the ordering/mode distinction. It doesn't cover to/from/subject substring nuances, but the schema does.

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?

States a specific verb+resource (find messages in an AgentMail inbox) and explicitly scopes the return to metadata (id, thread, sender, recipients, subject, date, preview, labels) rather than full bodies. It routes to the correct sibling tools (get_agentmail_message, update_agentmail_labels), clearly distinguishing it from retrieval and labeling operations.

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

Usage Guidelines5/5

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

Explicitly explains the two modes: with `query` it does full-text search best-match-first; without it, it returns newest messages optionally filtered. It names the follow-up alternatives get_agentmail_message and update_agentmail_labels, and states trash/spam exclusion with an override. When-to-use is fully covered.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources