google-workspace-cli
Original:🇺🇸 English
Translated
Interact with all Google Workspace APIs via the gws CLI. Use when managing Drive files, sending/reading Gmail, creating Calendar events, reading/writing Sheets/Docs/Slides, managing Chat spaces, contacts, Admin users/groups, Vault eDiscovery, Classroom, Apps Script, Workspace Events, or configuring the gws MCP server. Triggers on Google Workspace, gws, Drive, Gmail, Calendar, Sheets, Docs, Slides, Chat, Tasks, Meet, Forms, Keep, Admin, People, Vault, Classroom, Apps Script, Cloud Identity, Alert Center, Groups Settings, Licensing, Reseller, Model Armor, gws CLI, gws mcp, Google API, Workspace automation, npx skills add.
7installs
Sourcehoodini/ai-agents-skills
Added on
NPX Install
npx skill4agent add hoodini/ai-agents-skills google-workspace-cliTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Google Workspace CLI (gws
)
gwsOne CLI for all of Google Workspace — Drive, Gmail, Calendar, Sheets, Docs, Slides, Chat, Tasks, Admin, Meet, Forms, Keep, and every other Workspace API. Built for humans and AI agents. Structured JSON output. 100+ agent skills included.
Note: This is not an officially supported Google product.
Important: This project is under active development. Expect breaking changes as we march toward v1.0.
Repository: https://github.com/googleworkspace/cli
How It Works
gwsgwsPrerequisites
- Node.js 18+ — for (or download a pre-built binary from GitHub Releases)
npm install - A Google Cloud project — required for OAuth credentials. You can create one via the Google Cloud Console, with the CLI, or with the
gcloudcommand.gws auth setup - A Google account with access to Google Workspace
Installation
bash
# Install globally via npm (recommended — bundles native binaries, no Rust needed)
npm install -g @googleworkspace/cli
# Verify installation
gws --versionAlternative installation methods:
bash
# From GitHub Releases (pre-built binaries)
# Download from: https://github.com/googleworkspace/cli/releases
# Build from source (requires Rust toolchain)
cargo install --git https://github.com/googleworkspace/cli --locked
# Nix flake
nix run github:googleworkspace/cliQuick Start
bash
gws auth setup # walks you through Google Cloud project config
gws auth login # subsequent OAuth login
gws drive files list --params '{"pageSize": 5}'Authentication
Which setup should I use?
| I have… | Use |
|---|---|
| |
A GCP project but no | Manual OAuth setup in Cloud Console |
| An existing OAuth access token | |
| Existing credentials JSON (service account or exported) | |
Quick Setup (recommended — requires gcloud CLI)
bash
gws auth setup # one-time: creates a Cloud project, enables APIs, logs you in
gws auth login # subsequent logins with scope selectionCredentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring.
Scoped Login (for unverified/testing OAuth apps, limited to ~25 scopes)
Warning: Unverified (testing-mode) apps are limited to ~25 OAuth scopes. Thescope preset includes 85+ scopes and will fail for unverified apps (especially forrecommendedaccounts). Choose individual services instead:@gmail.com
bash
# Select only the services you need to stay under the scope limit
gws auth login -s drive,gmail,sheets
gws auth login --scopes drive,gmail,calendar,docs,chatMultiple Accounts
bash
gws auth login --account work@corp.com
gws auth login --account personal@gmail.com
gws auth list # list registered accounts
gws auth default work@corp.com # set the default
gws --account personal@gmail.com drive files list # one-off override
export GOOGLE_WORKSPACE_CLI_ACCOUNT=personal@gmail.com # env var overrideCredentials are stored per-account as in , with an registry tracking defaults.
credentials.<b64-email>.enc~/.config/gws/accounts.jsonManual OAuth Setup (no gcloud)
Use this when cannot automate project/client creation, or when you want explicit control.
gws auth setup- Open Google Cloud Console in the target project:
- OAuth consent screen:
https://console.cloud.google.com/apis/credentials/consent?project=<PROJECT_ID> - Credentials:
https://console.cloud.google.com/apis/credentials?project=<PROJECT_ID>
- OAuth consent screen:
- Configure OAuth branding/audience if prompted — App type: External (testing mode is fine)
- Add your account under Test users
- Create an OAuth client — Type: Desktop app
- Download the client JSON → save to
~/.config/gws/client_secret.json
Important: You must add yourself as a test user. In the OAuth consent screen, click Test users → Add users and enter your Google account email. Without this, login will fail with a generic "Access blocked" error.
Then run:
bash
gws auth loginHeadless / CI
bash
# On a machine with a browser:
gws auth export --unmasked > credentials.json
# On the headless machine:
export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/credentials.json
gws drive files list # just worksService Account (server-to-server)
bash
export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/service-account.json
gws drive files list
# For Domain-Wide Delegation:
export GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER=admin@example.comPre-obtained Access Token
bash
export GOOGLE_WORKSPACE_CLI_TOKEN=$(gcloud auth print-access-token)Browser-Assisted Auth (for AI agents)
Agents can complete OAuth with browser automation:
- Human flow: Run , open the printed URL, approve scopes.
gws auth login - Agent-assisted flow: The agent opens the URL, selects the account, handles consent prompts, and returns control once the localhost callback succeeds.
If consent shows "Google hasn't verified this app" (testing mode), click Continue. If scope checkboxes appear, select required scopes (or Select all) before continuing.
Auth Precedence
| Priority | Method | Source |
|---|---|---|
| 1 | Access token | |
| 2 | Credentials file | |
| 3 | Per-account encrypted credentials | |
| 4 | Plaintext credentials | |
Account resolution: flag > env var > default in .
--accountGOOGLE_WORKSPACE_CLI_ACCOUNTaccounts.jsonAll environment variables can also live in afile in your project root..env
Command Structure
The universal pattern for ALL gws commands:
gws <service> <resource> <method> [--params '{ JSON }'] [--json '{ JSON }'] [flags]Global Flags
| Flag | Description |
|---|---|
| Show help for any service, resource, or method |
| URL/query parameters as JSON |
| Request body as JSON |
| Preview the HTTP request without executing |
| Auto-paginate, one JSON line per page (NDJSON) |
| Max pages to fetch (default: 10) |
| Delay between pages (default: 100ms) |
| Multipart file upload |
| Use a specific authenticated account |
| Model Armor response sanitization |
Introspecting Schemas
bash
# See the full request/response schema for any method
gws schema drive.files.list
gws schema gmail.users.messages.send
gws schema calendar.events.insertCore Services — Commands & Examples
Google Drive
bash
# List files (paginated)
gws drive files list --params '{"pageSize": 10}'
# List ALL files (auto-paginate as NDJSON)
gws drive files list --params '{"pageSize": 100}' --page-all
# Search for files
gws drive files list --params '{"q": "name contains '\''report'\'' and mimeType = '\''application/pdf'\''", "pageSize": 20}'
# Get file metadata
gws drive files get --params '{"fileId": "FILE_ID"}'
# Upload a file
gws drive files create --json '{"name": "report.pdf", "parents": ["FOLDER_ID"]}' --upload ./report.pdf
# Create a folder
gws drive files create --json '{"name": "Project Docs", "mimeType": "application/vnd.google-apps.folder"}'
# Move a file to a folder
gws drive files update --params '{"fileId": "FILE_ID", "addParents": "FOLDER_ID", "removeParents": "OLD_PARENT_ID"}'
# Share a file
gws drive permissions create --params '{"fileId": "FILE_ID"}' --json '{"role": "writer", "type": "user", "emailAddress": "user@example.com"}'
# Download a file (export Google Docs as PDF)
gws drive files export --params '{"fileId": "FILE_ID", "mimeType": "application/pdf"}'
# Delete a file
gws drive files delete --params '{"fileId": "FILE_ID"}'
# List shared drives
gws drive drives list --params '{"pageSize": 10}'
# Create a shared drive
gws drive drives create --params '{"requestId": "unique-id"}' --json '{"name": "Team Drive"}'Gmail
bash
# List messages in inbox
gws gmail users messages list --params '{"userId": "me", "maxResults": 10}'
# Search messages
gws gmail users messages list --params '{"userId": "me", "q": "from:boss@company.com is:unread", "maxResults": 20}'
# Get a specific message
gws gmail users messages get --params '{"userId": "me", "id": "MESSAGE_ID"}'
# Send an email
gws gmail users messages send --params '{"userId": "me"}' --json '{
"raw": "<BASE64_ENCODED_RFC2822_MESSAGE>"
}'
# List labels
gws gmail users labels list --params '{"userId": "me"}'
# Create a label
gws gmail users labels create --params '{"userId": "me"}' --json '{"name": "Important/Projects"}'
# Modify message labels
gws gmail users messages modify --params '{"userId": "me", "id": "MESSAGE_ID"}' --json '{"addLabelIds": ["LABEL_ID"], "removeLabelIds": ["INBOX"]}'
# Trash a message
gws gmail users messages trash --params '{"userId": "me", "id": "MESSAGE_ID"}'
# List drafts
gws gmail users drafts list --params '{"userId": "me"}'
# Create a draft
gws gmail users drafts create --params '{"userId": "me"}' --json '{
"message": {"raw": "<BASE64_ENCODED_RFC2822_MESSAGE>"}
}'
# Set vacation auto-reply
gws gmail users settings updateVacation --params '{"userId": "me"}' --json '{
"enableAutoReply": true,
"responseSubject": "Out of Office",
"responseBodyPlainText": "I am out of office until March 10.",
"restrictToContacts": false,
"restrictToDomain": false
}'Google Calendar
bash
# List upcoming events
gws calendar events list --params '{"calendarId": "primary", "timeMin": "2026-03-05T00:00:00Z", "maxResults": 10, "singleEvents": true, "orderBy": "startTime"}'
# Get a specific event
gws calendar events get --params '{"calendarId": "primary", "eventId": "EVENT_ID"}'
# Create an event
gws calendar events insert --params '{"calendarId": "primary"}' --json '{
"summary": "Team Standup",
"description": "Daily standup meeting",
"start": {"dateTime": "2026-03-06T09:00:00-05:00", "timeZone": "America/New_York"},
"end": {"dateTime": "2026-03-06T09:30:00-05:00", "timeZone": "America/New_York"},
"attendees": [{"email": "alice@example.com"}, {"email": "bob@example.com"}]
}'
# Update an event
gws calendar events update --params '{"calendarId": "primary", "eventId": "EVENT_ID"}' --json '{
"summary": "Updated Standup",
"start": {"dateTime": "2026-03-06T10:00:00-05:00"},
"end": {"dateTime": "2026-03-06T10:30:00-05:00"}
}'
# Delete an event
gws calendar events delete --params '{"calendarId": "primary", "eventId": "EVENT_ID"}'
# List calendars
gws calendar calendarList list
# Check free/busy
gws calendar freebusy query --json '{
"timeMin": "2026-03-06T08:00:00Z",
"timeMax": "2026-03-06T18:00:00Z",
"items": [{"id": "alice@example.com"}, {"id": "bob@example.com"}]
}'
# Create a recurring event
gws calendar events insert --params '{"calendarId": "primary"}' --json '{
"summary": "Weekly Review",
"recurrence": ["RRULE:FREQ=WEEKLY;BYDAY=FR"],
"start": {"dateTime": "2026-03-06T16:00:00-05:00", "timeZone": "America/New_York"},
"end": {"dateTime": "2026-03-06T17:00:00-05:00", "timeZone": "America/New_York"}
}'Google Sheets
Important: Sheets ranges use which bash interprets as history expansion. Always wrap values in single quotes.
!bash
# Create a spreadsheet
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'
# Read cells
gws sheets spreadsheets values get --params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1:C10"}'
# Write cells
gws sheets spreadsheets values update --params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1", "valueInputOption": "USER_ENTERED"}' --json '{"values": [["Name", "Score"], ["Alice", 95], ["Bob", 87]]}'
# Append rows
gws sheets spreadsheets values append --params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1", "valueInputOption": "USER_ENTERED"}' --json '{"values": [["Charlie", 92]]}'
# Get spreadsheet metadata
gws sheets spreadsheets get --params '{"spreadsheetId": "SPREADSHEET_ID"}'
# Clear a range
gws sheets spreadsheets values clear --params '{"spreadsheetId": "SPREADSHEET_ID", "range": "Sheet1!A1:C10"}'
# Batch update (add sheet, format cells, etc.)
gws sheets spreadsheets batchUpdate --params '{"spreadsheetId": "SPREADSHEET_ID"}' --json '{
"requests": [
{"addSheet": {"properties": {"title": "March Data"}}},
{"repeatCell": {
"range": {"sheetId": 0, "startRowIndex": 0, "endRowIndex": 1},
"cell": {"userEnteredFormat": {"textFormat": {"bold": true}}},
"fields": "userEnteredFormat.textFormat.bold"
}}
]
}'Google Docs
bash
# Create a document
gws docs documents create --json '{"title": "Meeting Notes"}'
# Get document content
gws docs documents get --params '{"documentId": "DOC_ID"}'
# Update document (insert text)
gws docs documents batchUpdate --params '{"documentId": "DOC_ID"}' --json '{
"requests": [
{"insertText": {"location": {"index": 1}, "text": "Hello, World!\n"}}
]
}'Google Slides
bash
# Create a presentation
gws slides presentations create --json '{"title": "Q1 Review"}'
# Get presentation
gws slides presentations get --params '{"presentationId": "PRES_ID"}'
# Add a slide
gws slides presentations batchUpdate --params '{"presentationId": "PRES_ID"}' --json '{
"requests": [
{"createSlide": {"slideLayoutReference": {"predefinedLayout": "TITLE_AND_BODY"}}}
]
}'Google Chat
bash
# List spaces
gws chat spaces list
# Send a message to a space
gws chat spaces messages create --params '{"parent": "spaces/SPACE_ID"}' --json '{"text": "Deploy complete."}'
# Get a message
gws chat spaces messages get --params '{"name": "spaces/SPACE_ID/messages/MSG_ID"}'
# List messages in a space
gws chat spaces messages list --params '{"parent": "spaces/SPACE_ID", "pageSize": 25}'
# Create a space
gws chat spaces create --json '{"displayName": "Project Alpha", "spaceType": "SPACE"}'Google Tasks
bash
# List task lists
gws tasks tasklists list
# Create a task list
gws tasks tasklists insert --json '{"title": "Sprint 42"}'
# List tasks in a list
gws tasks tasks list --params '{"tasklist": "TASKLIST_ID"}'
# Create a task
gws tasks tasks insert --params '{"tasklist": "TASKLIST_ID"}' --json '{"title": "Review PR #123", "due": "2026-03-07T00:00:00Z"}'
# Complete a task
gws tasks tasks update --params '{"tasklist": "TASKLIST_ID", "task": "TASK_ID"}' --json '{"status": "completed"}'Google Meet
bash
# Create a meeting space
gws meet spaces create --json '{}'
# Get meeting space info
gws meet spaces get --params '{"name": "spaces/SPACE_ID"}'Google Forms
bash
# Create a form
gws forms forms create --json '{"info": {"title": "Feedback Survey"}}'
# Get form
gws forms forms get --params '{"formId": "FORM_ID"}'
# List responses
gws forms forms responses list --params '{"formId": "FORM_ID"}'Google Admin (Directory)
bash
# List users
gws admin users list --params '{"domain": "example.com", "maxResults": 100}'
# Get a user
gws admin users get --params '{"userKey": "user@example.com"}'
# Create a user
gws admin users insert --json '{
"primaryEmail": "newuser@example.com",
"name": {"givenName": "Jane", "familyName": "Doe"},
"password": "TempP@ssw0rd!"
}'
# List groups
gws admin groups list --params '{"domain": "example.com"}'
# Add member to group
gws admin members insert --params '{"groupKey": "group@example.com"}' --json '{"email": "user@example.com", "role": "MEMBER"}'Google Keep
bash
# List notes
gws keep notes list
# Get a note
gws keep notes get --params '{"name": "notes/NOTE_ID"}'Google People (Contacts & Profiles)
bash
# List contacts
gws people people connections list --params '{"resourceName": "people/me", "personFields": "names,emailAddresses,phoneNumbers", "pageSize": 50}'
# Get a specific contact
gws people people get --params '{"resourceName": "people/PERSON_ID", "personFields": "names,emailAddresses,organizations"}'
# Search contacts
gws people people searchContacts --params '{"query": "Alice", "readMask": "names,emailAddresses"}'
# Create a contact
gws people people createContact --json '{
"names": [{"givenName": "Jane", "familyName": "Smith"}],
"emailAddresses": [{"value": "jane@example.com"}],
"phoneNumbers": [{"value": "+1-555-0100"}]
}'
# List directory (domain contacts)
gws people people listDirectoryPeople --params '{"readMask": "names,emailAddresses", "sources": ["DIRECTORY_SOURCE_TYPE_DOMAIN_PROFILE"], "pageSize": 100}'Google Workspace Events
bash
# Create a subscription to watch for changes
gws events subscriptions create --json '{
"targetResource": "//calendar.googleapis.com/calendars/primary",
"eventTypes": ["google.workspace.calendar.event.v1.created"],
"notificationEndpoint": {"pubsubTopic": "projects/PROJECT/topics/TOPIC"},
"payloadOptions": {"includeResource": true}
}'
# List subscriptions
gws events subscriptions list
# Delete a subscription
gws events subscriptions delete --params '{"name": "subscriptions/SUB_ID"}'Google Vault (eDiscovery)
bash
# List matters
gws vault matters list
# Create a matter
gws vault matters create --json '{"name": "Investigation Q1", "description": "Q1 compliance audit"}'
# Create a hold
gws vault matters holds create --params '{"matterId": "MATTER_ID"}' --json '{
"name": "Email Hold",
"corpus": "MAIL",
"accounts": [{"accountId": "user@example.com"}]
}'Google Classroom
bash
# List courses
gws classroom courses list
# Create a course
gws classroom courses create --json '{"name": "CS101", "section": "Fall 2026", "ownerId": "me"}'
# List students in a course
gws classroom courses students list --params '{"courseId": "COURSE_ID"}'
# Create coursework
gws classroom courses courseWork create --params '{"courseId": "COURSE_ID"}' --json '{
"title": "Assignment 1",
"workType": "ASSIGNMENT",
"dueDate": {"year": 2026, "month": 3, "day": 15}
}'Admin Reports (Audit Logs)
bash
# List admin activities
gws admin-reports activities list --params '{"userKey": "all", "applicationName": "admin", "maxResults": 50}'
# List login activities
gws admin-reports activities list --params '{"userKey": "all", "applicationName": "login", "maxResults": 50}'
# List Drive audit logs
gws admin-reports activities list --params '{"userKey": "all", "applicationName": "drive", "maxResults": 50}'Alert Center (Security Alerts)
bash
# List alerts
gws alertcenter alerts list
# Get alert details
gws alertcenter alerts get --params '{"alertId": "ALERT_ID"}'Cloud Identity
bash
# List groups
gws cloudidentity groups list --params '{"parent": "customers/CUSTOMER_ID"}'
# Search groups
gws cloudidentity groups search --params '{"query": "parent == \"customers/CUSTOMER_ID\""}'
# List memberships
gws cloudidentity groups memberships list --params '{"parent": "groups/GROUP_ID"}'Groups Settings
bash
# Get group settings
gws groupssettings groups get --params '{"groupUniqueId": "group@example.com"}'
# Update group settings
gws groupssettings groups update --params '{"groupUniqueId": "group@example.com"}' --json '{
"whoCanPostMessage": "ALL_MEMBERS_CAN_POST",
"messageModerationLevel": "MODERATE_NONE"
}'Licensing
bash
# List license assignments
gws licensing licenseAssignments listForProduct --params '{"productId": "Google-Apps", "customerId": "CUSTOMER_ID"}'
# Assign a license
gws licensing licenseAssignments insert --params '{"productId": "Google-Apps", "skuId": "SKU_ID"}' --json '{"userId": "user@example.com"}'Reseller
bash
# List subscriptions
gws reseller subscriptions list --params '{"customerId": "CUSTOMER_ID"}'
# Get a subscription
gws reseller subscriptions get --params '{"customerId": "CUSTOMER_ID", "subscriptionId": "SUB_ID"}'Apps Script
bash
# List projects
gws apps-script projects list
# Get project content
gws apps-script projects getContent --params '{"scriptId": "SCRIPT_ID"}'
# Deploy a project
gws apps-script projects deployments create --params '{"scriptId": "SCRIPT_ID"}' --json '{"versionNumber": 1}'
# Run a function
gws apps-script scripts run --params '{"scriptId": "SCRIPT_ID"}' --json '{"function": "myFunction", "parameters": []}'Workflow Helpers (Shortcut Commands)
gwsbash
# --- Drive ---
# Upload a file to Drive with automatic metadata
gws drive-upload ./report.pdf
# --- Sheets ---
# Append a row to a sheet
gws sheets-append --spreadsheet-id ID --range 'Sheet1!A1' --values '[["Name", "Score"]]'
# Read sheet values
gws sheets-read --spreadsheet-id ID --range 'Sheet1!A1:C10'
# --- Gmail ---
# Send an email (simplified)
gws gmail-send --to user@example.com --subject "Hello" --body "Hi there"
# Triage inbox — show unread summary (sender, subject, date)
gws gmail-triage
# Watch for new emails and stream them as NDJSON
gws gmail-watch
# --- Calendar ---
# Show upcoming calendar agenda across all calendars
gws calendar-agenda
# Insert a calendar event quickly
gws calendar-insert --summary "Lunch" --start "2026-03-06T12:00:00" --end "2026-03-06T13:00:00"
# --- Docs ---
# Append text to a Google Doc
gws docs-write --document-id DOC_ID --text "New paragraph here"
# --- Chat ---
# Send a Chat message to a space
gws chat-send --space "spaces/SPACE_ID" --text "Hello team!"
# --- Apps Script ---
# Upload local files to an Apps Script project
gws apps-script-push --script-id SCRIPT_ID --source ./src
# --- Workspace Events ---
# Subscribe to Workspace events and stream them as NDJSON
gws events-subscribe --target "//calendar.googleapis.com/calendars/primary" --event-types "google.workspace.calendar.event.v1.created"
# Renew/reactivate Workspace Events subscriptions
gws events-renew --subscription-id SUB_ID
# --- Model Armor ---
# Sanitize a user prompt through a Model Armor template
gws modelarmor-sanitize-prompt --template "projects/P/locations/L/templates/T" --text "user input here"
# Sanitize a model response through a Model Armor template
gws modelarmor-sanitize-response --template "projects/P/locations/L/templates/T" --text "model output here"
# Create a new Model Armor template
gws modelarmor-create-template --project PROJECT --location LOCATION --template-id my-template
# --- Cross-service Workflows ---
# Today's standup report (meetings + open tasks)
gws workflow-standup-report
# Meeting prep (agenda, attendees, linked docs)
gws workflow-meeting-prep
# Convert email to task
gws workflow-email-to-task --message-id MSG_ID
# Weekly digest (meetings + unread count)
gws workflow-weekly-digest
# Announce a Drive file in a Chat space
gws workflow-file-announce --file-id FILE_ID --space "spaces/SPACE_ID"Installing gws Skills Into Your Agent Project
The gws repo ships 100+ SKILL.md files you can install directly into your agent's skills directory:
bash
# Install ALL gws skills at once
npx skills add https://github.com/googleworkspace/cli
# Or pick only what you need
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-drive
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-gmail
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-calendar
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-sheets
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-docs
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/gws-chatbash
# Symlink all skills (stays in sync with repo)
ln -s $(pwd)/skills/gws-* ~/.openclaw/skills/
# Or copy specific skills
cp -r skills/gws-drive skills/gws-gmail ~/.openclaw/skills/The skill includes an block so OpenClaw auto-installs the CLI via if isn't on PATH.
</details>
gws-sharedinstallnpmgwsThis places SKILL.md files into your project's (Copilot), (Claude Code), or equivalent directory, giving your agent deep per-service knowledge.
.github/skills/.claude/skills/Personas (Role-Based Skill Bundles)
The gws repo includes 10 pre-built persona bundles that combine multiple services for common roles:
| Persona | Description | Services Used |
|---|---|---|
| Manage an executive's schedule, inbox, and communications | Calendar, Gmail, Chat, Tasks |
| Coordinate projects — track tasks, schedule meetings, share docs | Tasks, Calendar, Drive, Chat |
| Handle HR workflows — onboarding, announcements, employee comms | Admin, Gmail, Calendar, Docs |
| Manage sales workflows — track deals, schedule calls, client comms | Sheets, Gmail, Calendar, Chat |
| Administer IT — manage users, monitor security, configure Workspace | Admin, Alert Center, Cloud Identity |
| Create, organize, and distribute content across Workspace | Docs, Slides, Drive, Gmail |
| Manage customer support — track tickets, respond, escalate issues | Gmail, Sheets, Chat, Tasks |
| Plan and manage events — scheduling, invitations, and logistics | Calendar, Gmail, Drive, Chat |
| Lead a team — run standups, coordinate tasks, communicate | Calendar, Tasks, Chat, Gmail |
| Organize research — manage references, notes, collaboration | Drive, Docs, Keep, Sheets |
Install a persona:
bash
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/persona-exec-assistant
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/persona-it-adminRecipes (Multi-Step Task Sequences)
The gws repo ships 50 curated recipes — multi-step task sequences with real commands. Key recipes:
| Recipe | What It Does |
|---|---|
| Find and review Drive files shared outside the org |
| Apply Gmail labels to matching messages and archive them |
| Read from Sheets, send personalized Gmail to each row |
| Read a Google Doc and use it as Gmail body |
| Create folder structure and move files into place |
| Share a Drive folder with collaborators |
| Share a file and email the link |
| Copy a Docs template, fill content, share |
| Set up Sheets for expense tracking |
| Create recurring focus time on Calendar |
| Move event and notify attendees |
| Find matching Gmail messages and export |
| Auto-label/star incoming messages |
| Delete event and send cancellation email |
| Query free/busy for multiple users |
| Download all files from a Drive folder |
| Identify large Drive files consuming storage |
| Create Shared Drive and add members |
| Transfer Drive file ownership between users |
| Create Doc, schedule Calendar review, notify via Chat |
| Save Gmail attachments to Drive |
| Announce via Gmail and Chat simultaneously |
| Create Form and share via Gmail |
| Export contacts directory to Sheets |
| Read Sheets data and create Calendar events |
| Read Sheets data and create Docs report |
| Archive Gmail message body into a Doc |
| Find matching emails and send standard reply |
| Rename Drive files to consistent naming |
| Enable Gmail out-of-office auto-reply |
| Review Workspace security alerts |
| Push local files to Apps Script project |
| Create Meet space and share join link |
| Create Slides presentation with initial slides |
| Create Classroom course and invite students |
Install recipes:
bash
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/recipe-send-personalized-emails
npx skills add https://github.com/googleworkspace/cli/tree/main/skills/recipe-audit-external-sharingMCP Server Integration
gws mcpbash
# Start MCP server for specific services
gws mcp -s drive # Drive only
gws mcp -s drive,gmail,calendar # multiple services
gws mcp -s all # all services (many tools!)
# Include workflow and helper tools
gws mcp -s drive,gmail -w -e
# Compact tool mode — reduces context window usage for LLMs
gws mcp -s drive,gmail --compactMCP Client Configuration
VS Code / Copilot ( or ):
settings.json.vscode/mcp.jsonjson
{
"mcpServers": {
"gws": {
"command": "gws",
"args": ["mcp", "-s", "drive,gmail,calendar,sheets,docs"]
}
}
}Claude Desktop ():
claude_desktop_config.jsonjson
{
"mcpServers": {
"gws": {
"command": "gws",
"args": ["mcp", "-s", "drive,gmail,calendar,sheets,docs"]
}
}
}Cursor ():
.cursor/mcp.jsonjson
{
"mcpServers": {
"gws": {
"command": "gws",
"args": ["mcp", "-s", "drive,gmail,calendar"]
}
}
}Gemini CLI Extension:
bash
gws auth setup
gemini extensions install https://github.com/googleworkspace/cliInstalling the Gemini extension gives your Gemini CLI agent direct access to all commands and skills. The extension automatically inherits your terminal credentials.
gwsTip: Each service adds roughly 10–80 tools. Keep the list to what you actually need to stay under your client's tool limit (typically 50–100 tools). Useflag to reduce context window usage.--compact
MCP Flags
| Flag | Description |
|---|---|
| Comma-separated services to expose, or |
| Also expose workflow tools |
| Also expose helper tools |
| Compact tool mode — reduces tool descriptions to save context window |
Advanced Usage
Dry Run (preview requests without executing)
bash
gws drive files list --params '{"pageSize": 5}' --dry-runPagination
bash
# Auto-paginate everything as NDJSON
gws drive files list --params '{"pageSize": 100}' --page-all
# Limit pages
gws drive files list --params '{"pageSize": 100}' --page-all --page-limit 5
# Delay between pages (rate limiting)
gws drive files list --params '{"pageSize": 100}' --page-all --page-delay 200Piping & Processing Output
All output is structured JSON. Pipe to for processing:
jqbash
# Get just file names
gws drive files list --params '{"pageSize": 100}' --page-all | jq -r '.files[].name'
# Get unread email subjects
gws gmail users messages list --params '{"userId": "me", "q": "is:unread", "maxResults": 5}' | jq '.messages[].id'
# Count events this week
gws calendar events list --params '{"calendarId": "primary", "timeMin": "2026-03-02T00:00:00Z", "timeMax": "2026-03-08T00:00:00Z", "singleEvents": true}' | jq '.items | length'Multipart Uploads
bash
gws drive files create --json '{"name": "report.pdf"}' --upload ./report.pdfModel Armor (Response Sanitization)
Scan API responses for prompt injection before they reach your agent:
bash
gws gmail users messages get --params '{"userId": "me", "id": "MSG_ID"}' \
--sanitize "projects/P/locations/L/templates/T"| Environment Variable | Description |
|---|---|
| Default Model Armor template |
| |
Agent Decision Guide
Use this table to decide which command to run based on what the user is asking:
gws| User Intent | Service | Example Command |
|---|---|---|
| List, search, upload, download, share files | | |
| Create folders, manage permissions | | |
| Read, send, search, label emails | | |
| Create drafts, manage filters | | |
| View, create, update, delete calendar events | | |
| Check availability / free-busy | | |
| Read, write, append spreadsheet data | | |
| Create spreadsheets, format cells | | |
| Create, read, edit documents | | |
| Create, edit presentations | | |
| Send messages, manage chat spaces | | |
| Manage tasks and to-do lists | | |
| Create meeting links | | |
| Create forms, read responses | | |
| Manage contacts and profiles | | |
| Manage users, groups, devices | | |
| Manage notes | | |
| Run/deploy Apps Script projects | | |
| Audit logs and usage reports | | |
| Manage security alerts | | |
| Manage identity and groups | | |
| Subscribe to Workspace events | | |
| Manage Google Vault (eDiscovery) | | |
| Manage Workspace licenses | | |
| Manage Google Classroom | | |
| Configure Google Groups settings | | |
| Manage Workspace subscriptions | | |
| Sanitize content for safety | | |
Environment Variables Reference
| Variable | Description |
|---|---|
| Pre-obtained OAuth access token |
| Path to credentials JSON (service account or exported) |
| Default account email |
| User to impersonate (domain-wide delegation) |
| Default Model Armor template |
| |
Troubleshooting
| Error | Fix |
|---|---|
| "Access blocked" or 403 during login | Add yourself as a test user in OAuth consent screen |
| "Google hasn't verified this app" | Click Advanced → Continue (safe for personal use) |
| Too many scopes error | Use |
| Install gcloud or set up OAuth manually in Cloud Console |
| Re-create OAuth client as Desktop app type |
| See detailed fix below |
| Stale credentials | Run |
API not enabled — accessNotConfigured
accessNotConfiguredIf a required Google API is not enabled for your GCP project, you will see a 403 error:
json
{
"error": {
"code": 403,
"message": "Gmail API has not been used in project 549352339482 ...",
"reason": "accessNotConfigured",
"enable_url": "https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482"
}
}gws💡 API not enabled for your GCP project.
Enable it at: https://console.developers.google.com/apis/api/gmail.googleapis.com/overview?project=549352339482
After enabling, wait a few seconds and retry your command.Steps to fix:
- Click the link (or copy it from the JSON
enable_urlfield).enable_url - In the GCP Console, click Enable.
- Wait ~10 seconds, then retry your command.
gws
Tip: You can also runwhich walks you through enabling all required APIs for your project automatically.gws auth setup
Architecture
gws- Read to identify the service (e.g.
argv[1])drive - Fetch the service's Discovery Document (cached 24 hours)
- Build a tree from the document's resources and methods
clap::Command - Re-parse the remaining arguments
- Authenticate, build the HTTP request, execute
All output — success, errors, download metadata — is structured JSON. This means every response is directly parseable by agents without any text extraction.
Resources
- GitHub Repo: https://github.com/googleworkspace/cli
- npm Package: https://www.npmjs.com/package/@googleworkspace/cli
- Skills Index (100+ skills): https://github.com/googleworkspace/cli/blob/main/docs/skills.md
- Google Discovery API: https://developers.google.com/discovery
- Google Workspace APIs: https://developers.google.com/workspace
- Releases & Binaries: https://github.com/googleworkspace/cli/releases
License
Apache-2.0