List Gmail Messages
gmail_list_messagesList Gmail messages filtered by search query, labels, and pagination, with output as markdown or JSON.
Instructions
List messages from Gmail with optional search filters.
Args:
query (string, optional): Gmail search query (e.g., 'from:boss@company.com is:unread', 'subject:invoice after:2024/01/01')
max_results (number): Maximum messages to return, 1-100 (default: 10)
label_ids (string[]): Filter by labels like 'INBOX', 'UNREAD', 'STARRED', 'SENT'
page_token (string, optional): Token for pagination
response_format ('markdown' | 'json'): Output format (default: 'markdown')
Returns: List of message summaries with ID, subject, from, date, and snippet.
Examples:
Unread emails: query="is:unread"
From specific sender: query="from:notifications@github.com"
Recent with attachment: query="has:attachment newer_than:7d"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Gmail search query (e.g., 'from:someone@example.com is:unread', 'subject:invoice') | |
| max_results | No | Maximum messages to return (1-100) | |
| label_ids | No | Filter by label IDs (e.g., ['INBOX', 'UNREAD', 'STARRED']) | |
| page_token | No | Token for pagination to retrieve the next page of results | |
| response_format | No | Output format: 'markdown' for human-readable or 'json' for structured data | markdown |