Skip to main content
Glama

Search Gmail

search_gmail_messages
Read-only

Search the user's connected Gmail mailboxes and return matching messages, newest first: from, to, subject, date, and a short snippet of the body. query uses Gmail search syntax: 'in:sent to:jane@acme.com' for messages the user sent to someone, 'from:jane@acme.com' for messages they received, plus operators like subject:, newer_than:7d, and has:attachment. So 'show me the last 5 messages I sent to jane@acme.com' is query 'in:sent to:jane@acme.com' with max_results 5. Each result carries a starred flag; a message the user starred matters to them, so weight it accordingly; 'is:starred' finds starred mail directly. For 'how many' questions, use total_matches_estimate in the result (it is Gmail's estimate of ALL matches, beyond the messages returned). If it reports no Gmail account connected, give the user the link it returns. Rare header-only connections cannot run query search; the tool says so. Answer correspondence questions from the brain for those.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search in Gmail query syntax, e.g. 'in:sent to:jane@acme.com newer_than:30d'.
accountNoEmail address of one connected mailbox to search. Omit to search all connected mailboxes.
max_resultsNoMax messages to return (default 10, max 100).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare readOnlyHint=true, so the description is not required to state read-only behavior. It goes far beyond by disclosing return ordering (newest first), the starred flag and its significance, the total_matches_estimate meaning, and edge-case behaviors (no account, header-only). This gives the agent a clear mental model of what to expect without needing to infer.

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?

The description is thorough but every sentence adds value. It front-loads the purpose and output, then layers query syntax, an example, special flags, and error handling. There is no fluff or repetition; it is structured to guide an agent step-by-step.

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?

Without an output schema, the description must explain return values, and it does: messages, fields, order, starred flag, and total_matches_estimate. It also covers error conditions and actionable next steps (give the user the link). For a tool with this complexity (Gmail search syntax, multiple edge cases), the description is fully sufficient for correct invocation.

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 coverage is 100%, so a baseline of 3 applies. The description significantly enhances parameter understanding: it explains Gmail query syntax with a concrete example ('in:sent to:jane@acme.com'), clarifies max_results default/max, and explains the account parameter's behavior (omit to search all). This goes well beyond the schema's bare parameter descriptions.

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 description opens with a specific verb and resource: 'Search the user's connected Gmail mailboxes and return matching messages.' It also specifies the output fields (from, to, subject, date, snippet) and ordering (newest first), making the tool's function unambiguous. This clearly distinguishes it from sibling tools like get_gmail_message or list_gmail_labels.

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?

The description provides concrete usage examples and guidance for special cases: using total_matches_estimate for count questions, handling no-account and header-only scenarios. However, it does not explicitly name alternatives (e.g., 'use get_gmail_message to fetch a specific message by ID') or state when NOT to use this tool. This is a minor gap but the practical guidance is strong.

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.