| name | Google (gogcli) |
| description | Access Gmail, Google Calendar, Drive, Contacts, Tasks, Sheets, Docs, and more via the gog CLI. Use when the user asks about email, calendar, files, contacts, or any Google service. |
Google CLI (gogcli)
Max can interact with Google services using the gog CLI tool. This covers Gmail, Calendar, Drive, Contacts, Tasks, Sheets, Docs, Slides, Forms, and more.
Prerequisites
gog must be installed: brew install steipete/tap/gogcli
- OAuth credentials must be stored:
gog auth credentials ~/path/to/client_secret.json
- User must be authenticated:
gog auth add user@gmail.com
- Check auth status:
gog auth status
If gog is not installed or not authenticated, guide the user through setup.
Important Flags
Always use these flags when running gog commands programmatically:
--json or -j — JSON output (best for parsing results)
--plain or -p — stable TSV output (good for simple lists)
--no-input — never prompt for input (prevents hanging)
--force or -y — skip confirmations for destructive commands
-a email@example.com — specify which Google account to use
Gmail
gog gmail search "is:unread" --json
gog gmail search "from:someone@example.com" --json
gog gmail search "subject:meeting is:unread newer_than:1d" --json
gog gmail get <messageId> --json
gog send --to "recipient@example.com" --subject "Hello" --body "Message body"
gog send --to "a@example.com" --cc "b@example.com" --subject "Hi" --body "Hello" --html
gog gmail messages reply <messageId> --body "Reply text"
gog gmail labels list --json
gog gmail thread get <threadId> --json
gog gmail thread modify <threadId> --add-labels "STARRED"
gog gmail thread modify <threadId> --remove-labels "UNREAD"
gog gmail drafts list --json
gog gmail drafts create --to "user@example.com" --subject "Draft" --body "Content"
Calendar
gog calendar events --json
gog calendar events --from "2025-01-01" --to "2025-01-31" --json
gog calendar calendars --json
gog calendar create <calendarId> --summary "Meeting" --start "2025-01-15T10:00:00" --end "2025-01-15T11:00:00"
gog calendar search "standup" --json
gog calendar conflicts --json
gog calendar respond <calendarId> <eventId> --status accepted
gog calendar freebusy "user@example.com" --from "2025-01-15" --to "2025-01-16" --json
For calendar IDs: use primary for the user's main calendar, or the calendar's email address.
Drive
gog ls --json
gog ls --parent <folderId> --json
gog search "quarterly report" --json
gog download <fileId>
gog download <fileId> --output /path/to/save
gog upload /path/to/file
gog upload /path/to/file --parent <folderId>
gog drive mkdir "New Folder"
gog drive mkdir "Subfolder" --parent <folderId>
gog drive share <fileId> --email "user@example.com" --role writer
gog drive get <fileId> --json
Contacts
gog contacts search "John" --json
gog contacts list --json
gog contacts create --given-name "John" --family-name "Doe" --email "john@example.com"
Tasks
gog tasks lists list --json
gog tasks list <tasklistId> --json
gog tasks add <tasklistId> --title "Buy groceries"
gog tasks done <tasklistId> <taskId>
Sheets
gog sheets get <spreadsheetId> --json
gog sheets values <spreadsheetId> "Sheet1!A1:D10" --json
gog sheets update <spreadsheetId> "Sheet1!A1" --values '[["Hello","World"]]'
Tips
- Use
gog whoami to check which account is active
- The
--json flag is your friend — always use it when you need to parse output
- Gmail search uses standard Gmail query syntax (same as the Gmail search bar)
- For calendar,
primary is the default calendar ID
- Most list commands support
--limit to control how many results to return
- Use
gog open <fileId> to get a browser URL for any Google resource