Skip to main content

Gmail

Send, search, and read emails via the Gmail API. Uses Google’s OAuth2 authentication.

Prerequisites

1

Install googleapis

2

Create OAuth2 Credentials

Go to Google Cloud Console, enable the Gmail API, and create OAuth2 credentials. Download credentials.json.
3

Generate Token

Run the Google OAuth flow to generate token.json. See the Gmail API quickstart.
4

Set Environment Variables


Quick Start


Config

string
Path to OAuth2 credentials JSON. Falls back to GMAIL_CREDENTIALS_PATH env var.
string
Path to saved token JSON. Falls back to GMAIL_TOKEN_PATH env var.
OAuth2Client
Pre-authenticated OAuth2 client (if you handle auth yourself).

Tools


Search Query Examples

The gmail_search tool accepts Gmail search syntax: