Loading...
Loading...
This skill should be used when searching, fetching, or downloading emails from Gmail. Use for queries like "search Gmail for...", "find emails from John", "show unread emails", "emails about project X", or "download attachment from email".
npx skill4agent add glebis/claude-skills gmail~/.gmail_credentials/setuppython3 scripts/gmail_search.py setup~/.gmail_credentials/credentials.json{
"installed": {
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"redirect_uris": ["http://localhost"]
}
}python3 scripts/gmail_search.py auth# Check setup status
python3 scripts/gmail_search.py setup
# Authenticate (opens browser)
python3 scripts/gmail_search.py auth
# Search emails
python3 scripts/gmail_search.py search "meeting notes"
# Search with filters
python3 scripts/gmail_search.py search --from "boss@company.com" --unreadpython3 scripts/gmail_search.py setup
python3 scripts/gmail_search.py setup --jsonpython3 scripts/gmail_search.py auth# View current scope
python3 scripts/gmail_search.py scope
# Change scope (requires re-auth)
python3 scripts/gmail_search.py scope --set readonly
python3 scripts/gmail_search.py scope --set modify
python3 scripts/gmail_search.py scope --set fullreadonlymodifyfull# Free-text search (uses Gmail search syntax)
python3 scripts/gmail_search.py search "project deadline"
python3 scripts/gmail_search.py search "from:john@example.com subject:invoice"
# Using helper flags
python3 scripts/gmail_search.py search --from "john@example.com"
python3 scripts/gmail_search.py search --to "me@example.com"
python3 scripts/gmail_search.py search --subject "Weekly Report"
python3 scripts/gmail_search.py search --label "INBOX"
python3 scripts/gmail_search.py search --label "work"
# Date filters (YYYY/MM/DD format)
python3 scripts/gmail_search.py search --after 2024/01/01
python3 scripts/gmail_search.py search --before 2024/12/31
python3 scripts/gmail_search.py search --after 2024/01/01 --before 2024/06/30
# Status filters
python3 scripts/gmail_search.py search --unread
python3 scripts/gmail_search.py search --starred
python3 scripts/gmail_search.py search --has-attachment
# Combined filters
python3 scripts/gmail_search.py search "invoice" --from "billing@" --has-attachment --after 2024/01/01
# Limit results
python3 scripts/gmail_search.py search "meeting" --limit 50
# Include full body (default shows snippet only)
python3 scripts/gmail_search.py search "contract" --full
# Include attachment info
python3 scripts/gmail_search.py search --has-attachment --attachments
# JSON output
python3 scripts/gmail_search.py search "project" --json# Download to default location (~/Downloads/gmail_attachments/)
python3 scripts/gmail_search.py download MESSAGE_ID
# Download to custom directory
python3 scripts/gmail_search.py download MESSAGE_ID --output /path/to/folder
# JSON output
python3 scripts/gmail_search.py download MESSAGE_ID --jsonpython3 scripts/gmail_search.py labels
python3 scripts/gmail_search.py labels --json# Gmail Search Results (3 messages)
## Weekly Report
**From:** boss@company.com
**To:** me@example.com
**Date:** Mon, 25 Nov 2024 10:00:00 +0000
**ID:** `18abc123def`
> Here's the weekly report summary...
-----json[
{
"id": "18abc123def",
"thread_id": "18abc123def",
"from": "boss@company.com",
"to": "me@example.com",
"subject": "Weekly Report",
"date": "Mon, 25 Nov 2024 10:00:00 +0000",
"snippet": "Here's the weekly report summary...",
"labels": ["INBOX", "UNREAD"]
}
]| Operator | Example | Description |
|---|---|---|
| | From specific sender |
| | To specific recipient |
| | In subject line |
| | Has specific label |
| | Has attachments |
| | Attachment filename |
| | Unread messages |
| | Starred messages |
| | After date |
| | Before date |
| | Within last N days |
| | Older than N months |
| | In specific folder |
| | Either condition |
| | Exclude |
| | Exact match |
| User says | Command |
|---|---|
| "Search Gmail for meeting notes" | |
| "Find emails from John" | |
| "Show unread emails" | |
| "Emails about the project from last month" | |
| "Invoices with attachments" | |
| "Read the full email about contract" | |
| "Download attachments from that email" | |
| "What labels do I have?" | |
| "Starred emails from boss" | |
| "Is Gmail configured?" | |
pip install google-api-python-client google-auth-httplib2 google-auth-oauthlib~/.gmail_credentials/credentials.json~/.gmail_credentials/token.pickle~/.gmail_credentials/scope.txt