{"id":514,"date":"2026-03-06T06:50:19","date_gmt":"2026-03-05T22:50:19","guid":{"rendered":"https:\/\/connectword.dpdns.org\/?p=514"},"modified":"2026-03-06T06:50:19","modified_gmt":"2026-03-05T22:50:19","slug":"google-ai-releases-a-cli-tool-gws-for-workspace-apis-providing-a-unified-interface-for-humans-and-ai-agents","status":"publish","type":"post","link":"https:\/\/connectword.dpdns.org\/?p=514","title":{"rendered":"Google AI Releases a CLI Tool (gws) for Workspace APIs: Providing a Unified Interface for Humans and AI Agents"},"content":{"rendered":"<p>Integrating Google Workspace APIs\u2014such as Drive, Gmail, Calendar, and Sheets\u2014into applications and data pipelines typically requires writing boilerplate code to handle REST endpoints, pagination, and OAuth 2.0 flows. Google AI team just released a CLI Tool (gws) for Google Workspace. The open-source <code>googleworkspace\/cli<\/code> (invoked via the <code>gws<\/code> command) provides a unified, dynamic command-line interface to manage these services.<\/p>\n<p>Designed for both human developers and AI agents, <code>gws<\/code> eliminates the need for custom wrapper scripts by providing structured JSON outputs, native Model Context Protocol (MCP) support, and automated authentication workflows.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Dynamic API Discovery Architecture<\/strong><\/h3>\n<p>Unlike traditional CLI tools that compile a static list of commands, <code>gws<\/code> builds its command surface dynamically at runtime.<\/p>\n<p>When executed, <code>gws<\/code> uses a two-phase parsing strategy:<\/p>\n<ol start=\"1\" class=\"wp-block-list\">\n<li>It reads the first argument to identify the target service (e.g., <code>drive<\/code>).<\/li>\n<li>It fetches that service\u2019s Google Discovery Document (cached for 24 hours).<\/li>\n<li>It builds a command tree from the document\u2019s resources and methods.<\/li>\n<li>It parses the remaining arguments, authenticates, and executes the HTTP request.<\/li>\n<\/ol>\n<p>Because of this architecture, <code>gws<\/code> automatically supports new Google Workspace API endpoints the moment they are added to the Discovery Service.<\/p>\n<h3 class=\"wp-block-heading\"><strong>Core Features for Software Engineers and Data Scientists<\/strong><\/h3>\n<p>The CLI can be installed via npm (<code>npm install -g @googleworkspace\/cli<\/code>) or built from source (<code>cargo install --path .<\/code>). Once installed, it offers several built-in utilities for data extraction and automation:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Introspection and Preview:<\/strong> Every resource includes <code>--help<\/code> documentation generated from the Discovery API. You can view the schema of any method (e.g., <code>gws schema drive.files.list<\/code>) or use the <code>--dry-run<\/code> flag to preview the exact HTTP request before execution.<\/li>\n<li><strong>Structured Data Extraction:<\/strong> By default, every response\u2014including errors and metadata\u2014is returned as structured JSON.<\/li>\n<li><strong>Auto-Pagination:<\/strong> For devs pulling large datasets, the <code>--page-all<\/code> flag automatically handles API cursors. It streams paginated results as NDJSON (Newline Delimited JSON), which can be piped directly into command-line JSON processors:Bash<code>gws drive files list --params '{\"pageSize\": 100}' --page-all | jq -r '.files[].name'<\/code><\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\"><strong>Integration with AI Agents and MCP<\/strong><\/h3>\n<p>A primary use case for <code>gws<\/code> is serving as a tool-calling backend for Large Language Models (LLMs).<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Model Context Protocol (MCP) Server:<\/strong> By running <code>gws mcp -s drive,gmail,calendar<\/code>, the CLI starts an MCP server over <code>stdio<\/code>. This exposes Workspace APIs as structured tools that any MCP-compatible client (like Claude Desktop or VS Code) can natively call.<\/li>\n<li><strong>Pre-built Agent Skills:<\/strong> The repository includes over 100 Agent Skills covering all supported APIs and common workflows. AI Engineers can install these directly into agent environments using <code>npx skills add github:googleworkspace\/cli<\/code>.<\/li>\n<li><strong>Gemini CLI Extension:<\/strong> Developers using the Gemini CLI can install the <code>gws<\/code> extension (<code>gemini extensions install https:\/\/github.com\/googleworkspace\/cli<\/code>), allowing the local Gemini agent to inherit <code>gws<\/code> credentials and manage Workspace resources natively.<\/li>\n<li><strong>Model Armor (Response Sanitization):<\/strong> To mitigate prompt injection risks when feeding API data to an LLM, <code>gws<\/code> supports Google Cloud Model Armor. Passing the <code>--sanitize<\/code> flag scans API responses for malicious payloads before the data reaches your agent.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\"><strong>Authentication Workflows<\/strong><\/h3>\n<p>The CLI handles authentication securely across different environments, replacing the need for manual token management in custom scripts. Precedence is given to explicit tokens, followed by credentials files, and finally local keyring storage.<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>Local Desktop:<\/strong> Running <code>gws auth setup<\/code> initiates an interactive flow to configure a Google Cloud project, enable necessary APIs, and handle OAuth login. Credentials are encrypted at rest using AES-256-GCM and stored in the OS keyring.<\/li>\n<li><strong>Headless \/ CI\/CD:<\/strong> For server environments, developers can complete the interactive auth locally and export the plaintext credentials:Bash<code>gws auth export --unmasked &gt; credentials.json <\/code>On the headless machine, point the CLI to this file using an environment variable: <code>export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=\/path\/to\/credentials.json<\/code>.<\/li>\n<li><strong>Service Accounts:<\/strong> <code>gws<\/code> natively supports server-to-server Service Account key files and Domain-Wide Delegation via the <code>GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER<\/code> variable.<\/li>\n<\/ul>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n<p>Check out the\u00a0<strong><a href=\"https:\/\/github.com\/googleworkspace\/cli\" target=\"_blank\" rel=\"noreferrer noopener\">Repo here<\/a>.\u00a0<\/strong>Also,\u00a0feel free to follow us on\u00a0<strong><a href=\"https:\/\/x.com\/intent\/follow?screen_name=marktechpost\" target=\"_blank\" rel=\"noreferrer noopener\"><mark>Twitter<\/mark><\/a><\/strong>\u00a0and don\u2019t forget to join our\u00a0<strong><a href=\"https:\/\/www.reddit.com\/r\/machinelearningnews\/\" target=\"_blank\" rel=\"noreferrer noopener\">120k+ ML SubReddit<\/a><\/strong>\u00a0and Subscribe to\u00a0<strong><a href=\"https:\/\/www.aidevsignals.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">our Newsletter<\/a><\/strong>. Wait! are you on telegram?\u00a0<strong><a href=\"https:\/\/t.me\/machinelearningresearchnews\" target=\"_blank\" rel=\"noreferrer noopener\">now you can join us on telegram as well.<\/a><\/strong><\/p>\n<p>The post <a href=\"https:\/\/www.marktechpost.com\/2026\/03\/05\/google-ai-releases-a-cli-tool-gws-for-workspace-apis-providing-a-unified-interface-for-humans-and-ai-agents\/\">Google AI Releases a CLI Tool (gws) for Workspace APIs: Providing a Unified Interface for Humans and AI Agents<\/a> appeared first on <a href=\"https:\/\/www.marktechpost.com\/\">MarkTechPost<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Integrating Google Workspace A&hellip;<\/p>\n","protected":false},"author":1,"featured_media":29,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/514","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=514"}],"version-history":[{"count":0,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/514\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=\/wp\/v2\/media\/29"}],"wp:attachment":[{"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/connectword.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}