Google Workspace CLI: One Tool to Rule Them All
#DevOps

Google Workspace CLI: One Tool to Rule Them All

Trends Reporter
3 min read

Google Workspace CLI brings unified command-line access to Drive, Gmail, Calendar, and more, with dynamic API discovery and AI agent skills.

Google has launched a unified command-line interface for Google Workspace that consolidates access to Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and more into a single tool. The Google Workspace CLI dynamically builds its command surface from Google's Discovery Service, meaning it automatically adapts when Google adds new API endpoints without requiring tool updates.

One CLI for All Workspace Services

The tool installs globally via npm: npm install -g @googleworkspace/cli. Once installed, users get tab-completion, built-in help, and the ability to preview requests with --dry-run before execution. The CLI outputs structured JSON by default, making it particularly useful for automation and AI agent integration.

For example, listing recent files becomes straightforward: gws drive files list --params '{"pageSize": 10}'. Creating a spreadsheet is equally simple: gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'. The tool handles pagination automatically and supports streaming results as NDJSON for large datasets.

Authentication That Works Everywhere

Authentication flexibility stands out as a key feature. The CLI supports interactive OAuth setup that walks users through Google Cloud project configuration, manual OAuth setup for those wanting explicit control, browser-assisted authentication for both humans and agents, headless/CI workflows using exported credentials, service account authentication for server-to-server access, and pre-obtained access tokens from tools like gcloud.

Credentials are encrypted at rest using AES-256-GCM with keys stored in the OS keyring for local use. The authentication system prioritizes access tokens first, then credentials files, encrypted credentials, and finally plaintext credentials.

Built for AI Agents

With 40+ agent skills included and over 100 total skills available, the CLI is designed for AI agent integration. Skills cover every supported API plus higher-level helpers for common workflows. Users can install all skills at once with npx skills add github:googleworkspace/cli or select specific ones.

The tool also functions as an MCP (Model Context Protocol) server, exposing Google Workspace APIs as structured tools that any MCP-compatible client can call. This allows AI assistants like Claude Desktop or Gemini CLI to directly manipulate Workspace data through natural commands.

Dynamic Discovery Architecture

Unlike traditional CLIs with static command lists, Google Workspace CLI reads Google's Discovery Service at runtime to build its entire command surface. This means when Google adds a new API endpoint or method, the CLI picks it up automatically without requiring updates. The tool uses a two-phase parsing strategy: first identifying the service from the initial argument, then fetching the service's Discovery Document to build a command tree before parsing remaining arguments.

Practical Use Cases

For developers, this eliminates the need to write custom curl calls against REST documentation. For AI agents, the structured JSON output paired with agent skills enables Workspace management without custom tooling. The CLI includes model armor integration for response sanitization, multipart upload support for files, and comprehensive error handling that provides actionable URLs when APIs aren't enabled.

While still under active development with expected breaking changes before v1.0, the Google Workspace CLI represents a significant step toward unified command-line access for Google's productivity suite, particularly valuable for automation workflows and AI agent integration.

Comments

Loading comments...