Google Workspace CLI: Built for AI Agents

Google open-sources gws, a Rust-built CLI that gives developers and AI agents unified access to every Workspace API — Drive, Gmail, Calendar, Sheets, Docs, and more — from a single command line.

Google Workspace CLI: Built for AI Agents

Google has released gws, an open-source command-line tool that provides unified access to the entire Google Workspace API surface. Published on GitHub under googleworkspace/cli, the tool is built in Rust, installable via npm, and — most notably — designed from the ground up for AI agent integration.

The CLI covers Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and every other Workspace service. But what makes it unusual is how it's built: commands aren't hard-coded. The tool generates them dynamically from Google's Discovery Service, which means it automatically picks up new API endpoints without needing an update.

One Binary, Every API

This is the first official CLI from Google for Workspace. Previously, developers had to use the REST APIs directly or rely on community-built wrappers. gws changes that with a single binary that handles authentication, pagination, structured output, and multi-account management out of the box.

The tool ships with 100+ agent skills — pre-built workflows for common tasks like searching Gmail, managing Drive files, creating Calendar events, and editing Sheets. These skills are designed to be called by AI agents, not just humans typing commands.

Most importantly, gws includes a built-in MCP (Model Context Protocol) server. This means Claude Desktop, Gemini CLI, VS Code, and any other MCP-compatible client can use Workspace APIs as structured tools. Launch it with gws mcp -s drive,gmail,calendar and your AI assistant can read your email, search your Drive, and check your schedule.

How It Works

Installation is straightforward: npm install -g @googleworkspace/cli (requires Node.js 18+). Pre-built binaries and Cargo install are also available.

Authentication supports five methods: interactive OAuth via gcloud CLI, manual OAuth through Google Cloud Console, service accounts for server-to-server automation, pre-obtained access tokens, and credentials files via environment variables. All credentials are encrypted with AES-256-GCM and stored in the OS keyring.

Under the hood, the CLI uses a two-phase parsing strategy. It identifies the target service from the first argument, fetches that service's Discovery Document (cached for 24 hours), builds a command structure from the document's resources and methods, then authenticates and executes. All output — including errors — is structured JSON, making it trivial to pipe into scripts or feed to AI agents.

For teams managing multiple Google accounts, gws supports seamless switching between profiles. Domain-wide delegation is supported for enterprise deployments, and there's a dry-run mode for previewing requests before execution.

Why Agents Care

The MCP server is the standout feature for the AI community. Each Workspace service exposes 10–80 tools through MCP, giving agents fine-grained access to Google's APIs. The 50+ curated recipes handle common multi-step workflows — like "find the latest expense report in Drive and email it to my manager" — as single tool calls. For teams deploying computer-use agents like GPT-5.4, having standardized tool access to Workspace is essential.

Google has also integrated Model Armor for response sanitization, adding a safety layer when agents are processing sensitive workspace data.

Goodbye Community Wrappers

Until now, connecting AI agents to Google Workspace meant using community-built MCP servers or writing custom API wrappers. These worked, but they were unofficial, inconsistently maintained, and covered only a fraction of Workspace's surface area. Other AI-first tools like Canvas in AI Mode show Google's commitment to building APIs and infrastructure for agentic workflows.

gws replaces all of that with a single supported tool that covers every Workspace API, updates automatically, and treats agents as first-class users. For teams building AI workflows that need to interact with Google's productivity suite, this is a major shift.

A note of caution: Google labels this as "not an officially supported Google product" and warns that breaking changes are expected before v1.0. It's usable today, but don't build mission-critical production pipelines on it just yet.

The source code and documentation are on GitHub.