name: google-workspace description: Access Google Workspace APIs (Drive, Docs, Calendar, Gmail, Sheets, Slides, People) via local helper scripts. Handles OAuth login and direct API calls. USE WHEN user wants to search Google Drive, check calendar, search Gmail, read Google Docs, or interact with any Google Workspace service.
Google Workspace
Access Google Workspace APIs from the agent via local Node.js helper scripts — no MCP server needed.
Supports: Drive, Docs, Calendar, Gmail, Sheets, Slides, People.
Files
All scripts live in the skill directory:
scripts/auth.js— login / status / clear tokenscripts/workspace.js— call APIs (generic and convenience commands)scripts/common.js— shared auth logic
Script base directory: ~/.config/claude/skills/GoogleWorkspace/scripts
One-Time Setup
1. Create OAuth Credentials
- Go to Google Cloud Console → Credentials
- Create an OAuth 2.0 Client ID (type: Desktop app)
- Download the JSON and save it to:
~/.config/google-workspace/credentials.json
- Enable these APIs in your Google Cloud project:
- Google Calendar API
- Google Drive API
- Gmail API
- Google Docs API
- Google Sheets API
- Google Slides API
- People API
2. Install Dependencies
Dependencies auto-install on first script run. To prewarm manually:
cd ~/.config/claude/skills/GoogleWorkspace/scripts
npm install
3. Authenticate
cd ~/.config/claude/skills/GoogleWorkspace/scripts
node auth.js login
This opens the browser for OAuth consent. Token is stored at ~/.config/google-workspace/token.json.
Operational Guidance for the Agent
- Always check auth first: Run
node auth.js statusbefore making API calls. - If auth is missing/expired: Run
node auth.js loginand wait for the user to complete browser consent. - Do not explain setup unless a command actually failed and its error output requires user action.
- Use
workspace.js callfor precise operations and return raw JSON results. - For user-friendly output: Post-process JSON after the call — summarize, format tables, extract key info.
- Never print token contents back to the user.
- Always
cdinto the scripts directory before running commands.
API Usage
Generic API Call
cd ~/.config/claude/skills/GoogleWorkspace/scripts
node workspace.js call <service> <method.path> '<json params>'
Services: drive, docs, calendar, gmail, sheets, slides, people
Examples:
# List 5 Drive files
node workspace.js call drive files.list '{"pageSize":5,"fields":"files(id,name)"}'
# Get today's calendar events
node workspace.js call calendar events.list '{"calendarId":"primary","maxResults":10,"singleEvents":true,"orderBy":"startTime"}'
# Get a Google Doc
node workspace.js call docs documents.get '{"documentId":"<DOC_ID>"}'
# List Gmail labels
node workspace.js call gmail users.labels.list '{"userId":"me"}'
# Read a spreadsheet
node workspace.js call sheets spreadsheets.values.get '{"spreadsheetId":"<SHEET_ID>","range":"Sheet1!A1:D10"}'
Convenience Commands
cd ~/.config/claude/skills/GoogleWorkspace/scripts
# Today's calendar events
node workspace.js calendar-today
# Next N days of events (default: 7)
node workspace.js calendar-upcoming 3
# Search Google Drive
node workspace.js drive-search "name contains 'Roadmap' and trashed=false"
# Search Gmail
node workspace.js gmail-search "from:alice@example.com newer_than:7d"
# Read a specific Gmail message (full body)
node workspace.js gmail-read <messageId>
Auth Commands
cd ~/.config/claude/skills/GoogleWorkspace/scripts
# Check auth status
node auth.js status
# Login (opens browser)
node auth.js login
# Clear stored token
node auth.js clear
Environment Overrides
| Variable | Default | Description |
|---|---|---|
GOOGLE_WORKSPACE_CONFIG_DIR |
~/.config/google-workspace |
Config directory |
GOOGLE_WORKSPACE_CREDENTIALS |
<config_dir>/credentials.json |
OAuth credentials file |
GOOGLE_WORKSPACE_TOKEN |
<config_dir>/token.json |
Stored token file |
Common Google API Patterns
Drive: Search by type
node workspace.js drive-search "mimeType='application/vnd.google-apps.document'"
node workspace.js drive-search "mimeType='application/vnd.google-apps.spreadsheet'"
node workspace.js drive-search "mimeType='application/vnd.google-apps.presentation'"
Drive: Recent files
node workspace.js call drive files.list '{"pageSize":10,"orderBy":"modifiedTime desc","fields":"files(id,name,mimeType,modifiedTime,webViewLink)"}'
Gmail: Common queries
node workspace.js gmail-search "is:unread newer_than:1d"
node workspace.js gmail-search "has:attachment newer_than:7d"
node workspace.js gmail-search "in:sent newer_than:1d"
Calendar: Specific calendar
node workspace.js calendar-today "work@redhat.com"