Gmail
Send, search, and read emails via the Gmail API. Uses Google’s OAuth2 authentication.Prerequisites
Create OAuth2 Credentials
Go to Google Cloud Console, enable the Gmail API, and create OAuth2 credentials. Download
credentials.json.Generate Token
Run the Google OAuth flow to generate
token.json. See the Gmail API quickstart.Quick Start
Config
Path to OAuth2 credentials JSON. Falls back to
GMAIL_CREDENTIALS_PATH env var.Path to saved token JSON. Falls back to
GMAIL_TOKEN_PATH env var.Pre-authenticated OAuth2 client (if you handle auth yourself).
Tools
| Tool | Description |
|---|---|
gmail_send | Send an email. Parameters: to, subject, body. |
gmail_search | Search emails. Parameters: query (Gmail search syntax), maxResults. |
gmail_read | Read full email content by message ID. |
Search Query Examples
Thegmail_search tool accepts Gmail search syntax:
| Query | Description |
|---|---|
is:unread | All unread emails |
from:john@example.com | Emails from a specific sender |
subject:meeting | Emails with “meeting” in subject |
has:attachment | Emails with attachments |
newer_than:2d | Emails from the last 2 days |