google-workspace
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGoogle Workspace (No MCP)
Google Workspace(无需MCP)
Use this skill when the user wants Google Workspace access in pi without MCP.
This skill provides local Node.js helper scripts for:
- OAuth login + token management
- Direct Google API calls (generic and convenience commands)
当用户希望在pi中无需MCP即可访问Google Workspace时,可使用此skill。
该skill提供本地Node.js辅助脚本,用于:
- OAuth登录 + 令牌管理
- 直接调用Google API(通用命令和便捷命令)
Files
文件
- — login/status/clear token
scripts/auth.js - — call APIs
scripts/workspace.js - — shared auth logic
scripts/common.js
- — 登录/状态查询/清除令牌
scripts/auth.js - — 调用API
scripts/workspace.js - — 共享认证逻辑
scripts/common.js
One-time setup
一次性设置
- Dependencies auto-install on first script run (or
auth.js).workspace.js
Optional (to prewarm manually):
bash
cd /Users/mitsuhiko/Development/agent-stuff/skills/google-workspace
npm install- Auth mode defaults to cloud (same hosted OAuth approach used by the workspace extension), so no local is required.
credentials.json
Optional local OAuth mode:
- Set
GOOGLE_WORKSPACE_AUTH_MODE=local - Create a Google OAuth Desktop app and place credentials at:
bash
~/.pi/google-workspace/credentials.jsonEnvironment overrides:
GOOGLE_WORKSPACE_CONFIG_DIRGOOGLE_WORKSPACE_CREDENTIALSGOOGLE_WORKSPACE_TOKEN- (
GOOGLE_WORKSPACE_AUTH_MODEorcloud)local - (cloud mode)
GOOGLE_WORKSPACE_CLIENT_ID - (cloud mode)
GOOGLE_WORKSPACE_CLOUD_FUNCTION_URL
- 首次运行脚本(或
auth.js)时会自动安装依赖。workspace.js
可选操作(手动预安装依赖):
bash
cd /Users/mitsuhiko/Development/agent-stuff/skills/google-workspace
npm install- 认证模式默认为云端(与workspace扩展使用相同的托管OAuth方式),因此无需本地文件。
credentials.json
可选的本地OAuth模式:
- 设置环境变量
GOOGLE_WORKSPACE_AUTH_MODE=local - 创建Google OAuth桌面应用,并将凭据文件放置在以下路径:
bash
~/.pi/google-workspace/credentials.json环境变量覆盖项:
GOOGLE_WORKSPACE_CONFIG_DIRGOOGLE_WORKSPACE_CREDENTIALSGOOGLE_WORKSPACE_TOKEN- (
GOOGLE_WORKSPACE_AUTH_MODE或cloud)local - (云端模式)
GOOGLE_WORKSPACE_CLIENT_ID - (云端模式)
GOOGLE_WORKSPACE_CLOUD_FUNCTION_URL
Authenticate
认证
bash
cd /Users/mitsuhiko/Development/agent-stuff/skills/google-workspace
node scripts/auth.js loginThis opens the browser for OAuth consent automatically.
If you run an API call without a token, will also trigger the same browser auth flow.
workspace.jsCheck auth status:
bash
node scripts/auth.js statusClear token:
bash
node scripts/auth.js clearbash
cd /Users/mitsuhiko/Development/agent-stuff/skills/google-workspace
node scripts/auth.js login此命令会自动打开浏览器进行OAuth授权。
如果您在没有令牌的情况下调用API,也会触发相同的浏览器认证流程。
workspace.js查询认证状态:
bash
node scripts/auth.js status清除令牌:
bash
node scripts/auth.js clearAPI usage
API使用方法
Generic API call
通用API调用
bash
node scripts/workspace.js call <service> <method.path> '<json params>'Examples:
bash
node scripts/workspace.js call drive files.list '{"pageSize":5,"fields":"files(id,name)"}'
node scripts/workspace.js call calendar events.list '{"calendarId":"primary","maxResults":10,"singleEvents":true,"orderBy":"startTime"}'
node scripts/workspace.js call docs documents.get '{"documentId":"<DOC_ID>"}'bash
node scripts/workspace.js call <service> <method.path> '<json params>'示例:
bash
node scripts/workspace.js call drive files.list '{"pageSize":5,"fields":"files(id,name)"}'
node scripts/workspace.js call calendar events.list '{"calendarId":"primary","maxResults":10,"singleEvents":true,"orderBy":"startTime"}'
node scripts/workspace.js call docs documents.get '{"documentId":"<DOC_ID>"}'Convenience commands
便捷命令
bash
node scripts/workspace.js calendar-today
node scripts/workspace.js drive-search "name contains 'Roadmap' and trashed=false"
node scripts/workspace.js gmail-search "from:alice@example.com newer_than:7d"bash
node scripts/workspace.js calendar-today
node scripts/workspace.js drive-search "name contains 'Roadmap' and trashed=false"
node scripts/workspace.js gmail-search "from:alice@example.com newer_than:7d"Operational guidance for the agent
Agent操作指南
- Always run first.
node scripts/auth.js status - If auth is missing/expired, run immediately and wait for user to complete browser consent.
node scripts/auth.js login - Do not just explain setup unless a command actually failed and its error output requires user action.
- Use for precise operations and return raw JSON results.
workspace.js call - For user-friendly output, post-process JSON after the call.
- Never print token contents back to the user.
- 始终先运行。
node scripts/auth.js status - 如果认证缺失/过期,立即运行,并等待用户完成浏览器授权。
node scripts/auth.js login - 除非命令实际失败且错误输出需要用户操作,否则不要仅解释设置步骤。
- 使用执行精确操作,并返回原始JSON结果。
workspace.js call - 若要输出用户友好的内容,需在调用后对JSON进行后处理。
- 绝不要将令牌内容打印给用户。