Unlock Google Workspace with gws: The All‑In‑One CLI for AI‑Powered Office Automation
The gws CLI bundles every Google Workspace API into a single command‑line tool, offering dynamic command generation, structured JSON output, and native MCP support for AI agents, with easy npm installation, step‑by‑step usage examples, OpenClaw integration, and essential tips to avoid common pitfalls.
Overview
gws is an open‑source command‑line interface that wraps the entire Google Workspace API suite (Drive, Gmail, Calendar, Sheets, Docs, etc.). It automatically fetches Google’s discovery documents at runtime, builds commands dynamically, handles pagination, and performs OAuth 2.0 authentication, returning all responses as structured JSON.
Key technical advantages
Dynamic command construction : Commands are generated from the latest discovery documents, so newly released Workspace endpoints are supported without updating the tool.
JSON‑first output : Every API response is returned as JSON, enabling AI agents or scripts to consume data without additional parsing.
Native MCP support : gws mcp -s drive,gmail,calendar launches an MCP server that exposes Workspace APIs to any AI‑agent platform (e.g., Claude Desktop, Cursor) with a single configuration step.
100+ ready‑to‑use Agent Skills : Pre‑built skills cover common workflows such as file management, email sending, calendar editing, and spreadsheet handling.
Installation
npm install -g @googleworkspace/cliAuthentication setup
Before using gws, install the Google Cloud SDK ( gcloud) and create a Google Cloud project. Then run: gws auth setup The wizard guides you through creating OAuth client credentials and enabling the required Workspace APIs (Drive, Gmail, Calendar are recommended). Authentication fails if gcloud is missing or the APIs are not enabled.
Typical usage examples
List the latest 10 files in Drive:
gws drive files list --params '{"pagesize": 10}'Create a spreadsheet named "Q1 Budget":
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'Send a notification to Google Chat (dry‑run):
gws chat spaces messages create --params '{"parent": "spaces/xyz"}' --json '{"text": "Deploy complete."}' --dry-runStream all pages of Drive files and extract names:
gws drive files list --params '{"pagesize": 100}' --page-all | jq -r '.files[].name'Inspect the request/response schema of any method:
gws schema drive.files.listMCP server for AI agents
Start an MCP server exposing selected services: gws mcp -s drive,gmail,calendar Configure the AI‑agent client to point to the MCP endpoint; the client can then invoke Workspace actions directly.
Agent Skills installation
All skills can be added with a single command:
npx skills add https://github.com/googleworkspace/cliAlternatively, synchronize the skills to OpenClaw:
ln -s $(pwd)/skills/gws-* ~/.openclaw/skills/OpenClaw integration
If OpenClaw is installed, the symlink above keeps the skill set up‑to‑date automatically. The gws‑shared skill also installs gws via npm on‑demand when OpenClaw detects it missing.
Caveats and best‑practice tips
Authentication requires a GCP project and the gcloud CLI; install gcloud before running gws auth setup.
gws is currently in a testing preview phase; avoid production use until a stable release is announced.
Some less common APIs (Slides, Forms, Classroom, etc.) are disabled by default and must be manually enabled during the auth setup.
Repository
https://github.com/googleworkspace/cli
AI Architecture Path
Focused on AI open-source practice, sharing AI news, tools, technologies, learning resources, and GitHub projects.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
