The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the MCP fork of Google Workspace CLI listing page.
One CLI for all of Google Workspace — built for humans and AI agents.
Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills included.
[!NOTE] This is not an officially supported Google product.
⬇️ Download the latest release for your OS
gws doesn't ship a static list of commands. It reads Google's own Discovery Service at runtime and builds its entire command surface dynamically. When Google Workspace adds an API endpoint or method, gws picks it up automatically.
[!IMPORTANT] This project is under active development. Expect breaking changes as we march toward v1.0.
npm install (or download a pre-built binary from GitHub Releases)gcloud CLI or with the gws auth setup command.The recommended way to install gws is to download the pre-built binary for your OS and architecture from the GitHub Releases page. Extract the archive and place the gws binary in your $PATH.
For convenience, you can also use npm to automate downloading the appropriate binary from GitHub Releases:
Or build from source:
A Nix flake is also available at github:googleworkspace/cli
On macOS and Linux, you can also install via Homebrew:
For humans — stop writing curl calls against REST docs. gws gives you --help on every resource, --dry-run to preview requests, and auto‑pagination.
For AI agents — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.
The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.
| I have… | Use |
|---|---|
gcloud installed and authenticated | gws auth setup (fastest) |
A GCP project but no gcloud | Manual OAuth setup |
| An existing OAuth access token | GOOGLE_WORKSPACE_CLI_TOKEN |
| Existing Credentials | GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE |
Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring (or ~/.config/gws/.encryption_key when GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file).
gws auth setuprequires thegcloudCLI. If you don't havegcloud, use the manual setup below instead.
[!WARNING] Scope limits in testing mode: If your OAuth app is unverified (testing mode), Google limits consent to ~25 scopes. The
recommendedscope preset includes 85+ scopes and will fail for unverified apps (especially for@gmail.comaccounts). Choose individual services instead to filter the scope picker:
Use this when gws auth setup cannot automate project/client creation, or when you want explicit control.
https://console.cloud.google.com/apis/credentials/consent?project=<PROJECT_ID>https://console.cloud.google.com/apis/credentials?project=<PROJECT_ID>~/.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:
You can complete OAuth either manually or with browser automation.
gws auth login, open the printed URL, approve scopes.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.
Point to your key file; no login needed.
Useful when another tool (e.g. gcloud) already mints tokens for your environment.
| Priority | Source | Set via |
|---|---|---|
| 1 | Access token | GOOGLE_WORKSPACE_CLI_TOKEN |
| 2 | Credentials file | GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE |
| 3 | Encrypted credentials | gws auth login |
| 4 | Plaintext credentials | ~/.config/gws/credentials.json |
Environment variables can also live in a .env file.
The repo ships 100+ Agent Skills (SKILL.md files) — one for every supported API, plus higher-level helpers for common workflows and 50 curated recipes for Gmail, Drive, Docs, Calendar, and Sheets. See the full Skills Index for the complete list.
The gws-shared skill includes an install block so OpenClaw auto-installs the CLI via npm if gws isn't on PATH.
Authenticate the CLI first:
Install the extension into the Gemini CLI:
Installing this extension gives your Gemini CLI agent direct access to all gws commands and Google Workspace agent skills. Because gws handles its own authentication securely, you simply need to authenticate your terminal once prior to using the agent, and the extension will automatically inherit your credentials.
| Flag | Description | Default |
|---|---|---|
--page-all | Auto-paginate, one JSON line per page (NDJSON) | off |
--page-limit <N> | Max pages to fetch | 10 |
--page-delay <MS> | Delay between pages | 100 ms |
Sheets ranges use ! which bash interprets as history expansion. Always wrap values in single quotes:
Some services ship hand-crafted helper commands alongside the auto-generated Discovery surface. Helper commands are prefixed with + so they are visually distinct and never collide with Discovery-generated method names.
Time-aware helpers (+agenda, +standup-report, +weekly-digest, +meeting-prep) automatically use your Google account timezone (fetched from Calendar Settings API and cached for 24 hours). Override with --timezone/--tz on +agenda, or set the --timezone flag for explicit control.
Run gws <service> --help to see both Discovery methods and helper commands together.
Full helper reference:
| Service | Command | Description |
|---|---|---|
gmail | +send | Send an email |
gmail | +reply | Reply to a message (handles threading automatically) |
gmail | +reply-all | Reply-all to a message |
gmail | +forward | Forward a message to new recipients |
gmail | +triage | Show unread inbox summary (sender, subject, date) |
gmail | +watch | Watch for new emails and stream them as NDJSON |
sheets | +append | Append a row to a spreadsheet |
sheets | +read | Read values from a spreadsheet |
docs | +write | Append text to a document |
chat | +send | Send a message to a space |
drive | +upload | Upload a file with automatic metadata |
calendar | +insert | Create a new event |
calendar | +agenda | Show upcoming events (uses Google account timezone; override with --timezone) |
script | +push | Replace all files in an Apps Script project with local files |
workflow | +standup-report | Today's meetings + open tasks as a standup summary |
workflow | +meeting-prep | Prepare for your next meeting: agenda, attendees, and linked docs |
workflow | +email-to-task | Convert a Gmail message into a Google Tasks entry |
workflow | +weekly-digest | Weekly summary: this week's meetings + unread email count |
workflow | +file-announce | Announce a Drive file in a Chat space |
events | +subscribe | Subscribe to Workspace events and stream them as NDJSON |
events | +renew | Renew/reactivate Workspace Events subscriptions |
modelarmor | +sanitize-prompt | Sanitize a user prompt through a Model Armor template |
modelarmor | +sanitize-response | Sanitize a model response through a Model Armor template |
modelarmor | +create-template | Create a new Model Armor template |
Examples:
Integrate Google Cloud Model Armor to scan API responses for prompt injection before they reach your agent.
| Variable | Description |
|---|---|
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
All variables are optional. See .env.example for a copy-paste template.
| Variable | Description |
|---|---|
GOOGLE_WORKSPACE_CLI_TOKEN | Pre-obtained OAuth2 access token (highest priority) |
GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE | Path to OAuth credentials JSON (user or service account) |
GOOGLE_WORKSPACE_CLI_CLIENT_ID | OAuth client ID (alternative to client_secret.json) |
GOOGLE_WORKSPACE_CLI_CLIENT_SECRET | OAuth client secret (paired with CLIENT_ID) |
GOOGLE_WORKSPACE_CLI_CONFIG_DIR | Override config directory (default: ~/.config/gws) |
GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE | Default Model Armor template |
GOOGLE_WORKSPACE_CLI_SANITIZE_MODE | warn (default) or block |
GOOGLE_WORKSPACE_CLI_LOG | Log level for stderr (e.g., gws=debug). Off by default. |
GOOGLE_WORKSPACE_CLI_LOG_FILE | Directory for JSON log files with daily rotation. Off by default. |
GOOGLE_WORKSPACE_PROJECT_ID | GCP project ID override for quota/billing and fallback for helper commands |
Environment variables can also be set in a .env file (loaded via dotenvy).
gws uses structured exit codes so scripts can branch on the failure type without parsing error output.
| Code | Meaning | Example cause |
|---|---|---|
0 | Success | Command completed normally |
1 | API error | Google returned a 4xx/5xx response |
2 | Auth error | Credentials missing, expired, or invalid |
3 | Validation error | Bad arguments, unknown service, invalid flag |
4 | Discovery error | Could not fetch the API schema document |
5 | Internal error | Unexpected failure |
gws uses a two-phase parsing strategy:
argv[1] to identify the service (e.g. drive)clap::Command tree from the document's resources and methodsAll output — success, errors, download metadata — is structured JSON.
Your OAuth app is in testing mode and your account is not listed as a test user.
Fix: Open the OAuth consent screen in your GCP project → Test users → Add users → enter your Google account email. Then retry gws auth login.
Expected when your app is in testing mode. Click Advanced → Go to <app name> (unsafe) to proceed. This is safe for personal use; verification is only required to publish the app to other users.
Unverified (testing mode) apps are limited to ~25 OAuth scopes. The recommended scope preset includes many scopes and will exceed this limit.
Fix: Select only the scopes you need:
gcloud CLI not foundgws auth setup requires the gcloud CLI to automate project creation. You have three options:
gcloud directly.gws auth setup which wraps gcloud calls.gcloud entirely — set up OAuth credentials manually in the Cloud Consoleredirect_uri_mismatchThe OAuth client was not created as a Desktop app type. In the Credentials page, delete the existing client, create a new one with type Desktop app, and download the new JSON.
accessNotConfiguredIf a required Google API is not enabled for your GCP project, you will see a
403 error with reason accessNotConfigured:
gws also prints an actionable hint to stderr:
Steps to fix:
enable_url link (or copy it from the enable_url JSON field).gws command.[!TIP] You can also run
gws auth setupwhich walks you through enabling all required APIs for your project automatically.
Apache-2.0
[!CAUTION] This is not an officially supported Google product.