
Google Workspace
FreeAccess Google Workspace APIs with local scripts.
Free · Opens the source repo
What Google Workspace does
The Google Workspace skill provides developers with a straightforward way to interact with various Google Workspace APIs, including Gmail, Drive, Calendar, Docs, Sheets, and more. This skill utilizes local helper scripts to manage authentication and execute API calls without the need for a managed cloud platform (MCP). By handling OAuth login and direct API interactions, it simplifies the process of integrating Google services into your applications.
The skill is built around a profile-based account model, meaning users must specify their email address for each API call. This approach allows for multiple accounts to be managed seamlessly, with tokens stored securely on a per-email basis. The included scripts, such as auth.js for authentication and workspace.js for executing API calls, provide essential functionality to facilitate user interactions with Google services. Users can enumerate accounts, log in, and execute calls to various services with minimal setup.
For developers looking to automate tasks or build applications that leverage Google Workspace, this skill offers a robust solution. The ability to run JavaScript code within the API calls allows for dynamic data handling and manipulation. Additionally, the skill provides guidance on best practices, such as using small payloads and handling errors related to authorization, ensuring a smooth development experience.
Overall, the Google Workspace skill is ideal for developers and designers who need to integrate Google services into their workflows efficiently. Its local execution model and clear structure make it accessible for both beginners and experienced users alike, providing a powerful tool for enhancing productivity and collaboration through Google Workspace.
When to use it
Use this skill when you need to perform automated tasks or integrate Google Workspace services into your applications locally.
When not to use it
This skill is not suitable for users who prefer a fully managed cloud solution or those who do not require local execution of API calls.
What you can build with it
Automating Gmail Tasks
Use the skill to automate email management tasks, such as counting messages in the trash or organizing your inbox.
Managing Google Drive Files
Quickly list or manipulate files in Google Drive through API calls, streamlining file management processes.
Scheduling Events in Calendar
Integrate with Google Calendar to create or modify events programmatically, enhancing scheduling efficiency.
How to install Google Workspace
View source1. Install with the skills CLI
npx skills add mitsuhiko/agent-stuff/google-workspace --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mitsuhikoGoogle Workspace
Use this skill for Google Workspace tasks (Gmail, Drive, Calendar, Docs, Sheets, etc.).
Files
scripts/auth.js— OAuth login/status/clear + account enumerationscripts/workspace.js— JavaScript execution based API runner
Account model (multi-account)
This skill is profile-based by email address.
- There is no default account.
- Every API call must specify
--email <account@example.com>. - Tokens are stored per-email under
~/.pi/google-workspace/tokens/.
Before running API calls, discover available signed-in accounts:
node scripts/auth.js accounts
Usage
Always use exec and always provide --email.
node scripts/workspace.js exec --email user@example.com <<'JS'
const me = await workspace.whoAmI();
const files = await workspace.call('drive', 'files.list', {
pageSize: 5,
fields: 'files(id,name,mimeType)',
});
return { me, files: files.files };
JS
Available inside exec scripts:
auth(authorized OAuth client)google(googleapisroot)workspace.accountEmail(selected profile email)workspace.call(service, methodPath, params, {version})workspace.service(service, {version})workspace.whoAmI()
Optional flags:
--timeout <ms>(default 30000, max 300000)--scopes s1,s2--script 'return 42'
Agent guidance
- Prefer one
execscript per user request. - Keep payloads small (
fields,maxResults, minimal props). - Use
Promise.allfor independent requests. - Never print token contents.
- If the user did not specify an account, run
node scripts/auth.js accountsand choose/confirm an explicit email. - If auth fails, first run
node scripts/auth.js accountsto see known profiles. - If account mismatch is possible, run
workspace.whoAmI()in the selected profile. - On 401/403/unauthorized errors, switch account (
--email ...) or re-login that specific profile.
Unauthorized/account-switch playbook
If a request fails with unauthorized/forbidden/insufficient permissions:
- Enumerate profiles:
node scripts/auth.js accounts
- Retry with the intended account:
node scripts/workspace.js exec --email correct-user@example.com <<'JS'
return await workspace.whoAmI();
JS
- If token is stale or missing scopes, re-login that account:
node scripts/auth.js login --email correct-user@example.com
- Retry the original request with the same
--email.
Short Gmail counting example
node scripts/workspace.js exec --email user@example.com <<'JS'
const gmail = google.gmail({ version: 'v1', auth });
let trash = 0;
let pageToken;
do {
const res = await gmail.users.messages.list({
userId: 'me',
q: 'in:trash',
maxResults: 500,
pageToken,
fields: 'messages/id,nextPageToken',
});
trash += (res.data.messages || []).length;
pageToken = res.data.nextPageToken;
} while (pageToken);
return { currentlyInTrash: trash };
JS
Setup + auth
node scripts/auth.js login --email user@example.com
Notes:
- Dependencies auto-install on first run.
- Default auth mode is cloud (no local
credentials.jsonneeded). - Optional local mode:
GOOGLE_WORKSPACE_AUTH_MODE=localand credentials at~/.pi/google-workspace/credentials.json. - Useful diagnostics:
node scripts/auth.js accounts
node scripts/auth.js status --email user@example.com
node scripts/auth.js clear --email user@example.com
Frequently asked questions about Google Workspace
Similar skills
Agent-Browser Core
Efficient browser automation for AI agents.
Setup My IQ
Effortlessly create and update your personal context portfolio.
CRM Maintenance
Automate HubSpot updates from your calendar and emails.
Zoom MCP
Streamline access to Zoom meeting assets and recordings.
Slack Automation
Automate tasks and extract data from Slack easily.
SMB Onboard
Guides small business owners through initial tool setup.
