CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

Google Workspace CLI

$ gws 官方出品 高风险
Google · 办公协作与 SaaS · Apache-2.0 · macos / linux / windows

Google Workspace CLI(gws)通过 Google Discovery Service 动态将 Drive、Gmail、Calendar、Sheets、Docs 与 Chat 封装为统一命令行工具。专为 AI Agent 场景打造,提供 --dry-run、结构化 JSON、Schema 自省以及官方 SKILL.md。

FCRS-1.0 综合评分
88 /100
良好 (Good)
中置信度 (源码/文档)
零摩擦安装命令
npm install -g @googleworkspace/cli
CLI vs MCP 选型建议 优先选 CLI

gws 通过 Discovery 覆盖全套 Workspace 服务,支持 --params / fields 掩码并自带官方 SKILL.md 与可选 MCP 模式,比多套独立 MCP 显著省上下文。

Agent 友好度体检单

✓ 原生 JSON 输出
✓ 字段裁剪
✓ 无头非交互
✓ 支持 Dry-Run
— 只读模式开关
— 支持 NO_COLOR
✓ 自省/Schema 发现
✓ 官方 SKILL.md

当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。

FCRS-1.0 六维评分拆解

Agent 友好度 24 / 25

专为 AI Agent 设计:全 JSON 输入输出、--params 字段裁剪、gws schema 运行时自省、--dry-run 与官方 SKILL.md 一应俱全。

  • Ships official SKILL.md files in googleworkspace/cli
  • Includes gws schema, --dry-run, and JSON payload I/O
安全与权限边界 19 / 25

支持 --dry-run、Model Armor 净化选项与细粒度 OAuth/服务账号,但 Gmail 与 Drive 本身涉及高敏感个人与企业数据。

  • Supports --dry-run validation and scoped OAuth tokens
  • External email sending and Drive deletions carry high real-world impact
安装与运行摩擦 12 / 15

支持 npm/Rust 跨平台安装,但个人账号首次配置需要在 GCP 中启用对应 API 并完成 OAuth 授权。

  • Distributed via @googleworkspace/cli and Rust releases; requires GCP OAuth setup
能力覆盖与边际价值 15 / 15

单二进制通过 Discovery 动态覆盖 Gmail、Drive、Calendar、Sheets、Docs 与 Chat。

  • Dynamic Discovery Service covers the entire Workspace API surface
维护与来源背书 9 / 10

Google Workspace 官方组织(googleworkspace/cli)以 Apache-2.0 积极维护。

  • Hosted under official googleworkspace GitHub org
文档与可验证性 9 / 10

仓库内直接提供完整 README、Schema 自检与现成 Agent Skills。

  • Repository includes agent skills and command examples

安全边界、鉴权与放权指南

鉴权方式
浏览器 OAuth 服务账号密钥 环境变量密钥
凭证存储位置

使用本地加密凭据存储 / 系统钥匙串(gws auth login),或通过 GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE 传入服务账号 JSON。

潜在副作用
只读查询 本地写入 远端写入 破坏性删除
费用与配额提示

CLI 以 Apache-2.0 开源免费;需配合 Google 账号 / GCP OAuth 客户端并受 Workspace API 配额限制。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# Google Workspace CLI (gws) Agent Rules
- Always inspect unfamiliar methods with `gws schema <method>` first.
- Pass `fields` in `--params` on list/get calls to minimize returned payload size.
- Require `--dry-run` preview and explicit user approval before sending emails (`gmail`) or deleting Drive files.

Agent 高频安全命令配方

只读查询(安全推荐)

使用字段掩码列出云盘文件
gws drive files list --params '{"pageSize": 10, "fields": "files(id,name,mimeType)"}'

通过 API fields 参数仅返回关键字段,防止冗余元数据撑爆上下文。

调用前先检查接口 Schema
gws schema drive.files.list

直接从 Google Discovery 打印准确的请求与响应结构。

受控写入与预演

用 --dry-run 预演云盘创建请求
gws drive files create --json '{"name":"report.md"}' --dry-run

在本地校验 JSON 请求载荷而不真正执行远端写入。

核心优势

  • + 原生随仓附带面向编码 Agent 的 SKILL.md 与 gws schema 自省能力。
  • + 一套工具统一操作 Drive、Gmail、Calendar、Sheets、Docs 与 Chat。
  • + --dry-run 可在触达线上 API 前先验证写入载荷。

注意事项与踩坑点

  • ! 首次登录需在 Google Cloud 项目中配置 OAuth 与启用相关 Workspace API。
  • ! 切勿向全自动无人值守循环授予无约束的 Gmail 发信或 Drive 删除权限。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI