Skip to main content
Glama

list_messages

Read-only

List messages from an authenticated Gmail mailbox with search queries, label filters, pagination, and optional spam/trash inclusion.

Instructions

List messages in the authenticated user's mailbox.

Args: query: Gmail search syntax filter, e.g. 'from:alice@example.com is:unread'. label_ids: Only return messages that have all of these label IDs (e.g. ['INBOX', 'UNREAD']). max_results: Maximum number of messages to return (default 50, max 500). page_token: Continuation token from a previous response for pagination. include_spam_trash: When True, include messages from SPAM and TRASH.

Returns: Dictionary with messages (id, thread_id), optional next_page_token, and result_size_estimate. Use get_message for headers/body. On API failure, returns {"error": "..."}.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "list_messages"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryNo
label_idsNo
page_tokenNo
max_resultsNo
include_spam_trashNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered; the description adds genuinely new behavior: pagination via page_token/next_page_token, a default of 50 with a 500 cap, SPAM/TRASH exclusion by default, and an error-return shape {'error': '...'}. It does not mention rate limits or quota behavior, keeping it at a 4.

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 one-line purpose is front-loaded and the Args/Returns structure is scannable, with each parameter line earning its place. The Returns block is slightly long given an output schema exists, but it conveys useful error semantics rather than padding.

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 five-parameter, zero-required read tool, the definition covers filtering, pagination, limits, and error behavior, and it warns that bodies require a follow-up call. It is essentially complete, with only secondary operational details like quotas or ordering guarantees absent.

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 must carry all parameter meaning, and it does: query gets Gmail syntax plus an example, label_ids gets AND semantics ('have all of these') plus example IDs, max_results gets default and hard cap, page_token gets its origin, and include_spam_trash gets its effect. Nothing needed to call it correctly is missing.

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?

Specific verb and resource ('List messages in the authenticated user's mailbox'), and it explicitly notes that listing returns only ids/thread_ids and that get_message should be used for headers/body. It does not differentiate itself from other listing siblings such as list_threads or list_drafts, so it stops just short of a 5.

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 gives a concrete usage pattern via the query example ('from:alice@example.com is:unread') and routes the agent to get_message when headers/body are needed, which is a real alternative. It lacks explicit exclusions (e.g., when to prefer a search tool over this listing) but the context is clear.

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

Deploy Server

Other Tools