Learn how to install, configure, and use the Google Workspace command-line tool.
The Google Workspace command-line tool, gwscli, is a unified terminal
client that connects AI agents such as Claude Code, Codex, and
Antigravity to Google Workspace services. After you
install the tool, connect your account, and install the packaged agent skills,
your agent runs the appropriate commands when you make requests in plain
language. The tool also supports developers working directly in an interactive
terminal.
You can authenticate interactively with a Google Account or pass an existing OAuth or domain-wide delegation access token. When accessing data in a Google Workspace organization, all actions follow the organization's administrator access and security policies. For details, see Set up authentication.
Because the tool discovers commands, parameters, and schemas dynamically at runtime, command interfaces and output schemas might change without backward compatibility. Don't rely on fixed command signatures in static scripts.
The tool provides the following features:
- Dynamic runtime command discovery and schema inspection for AI agents
- Structured JSON output for automated data processing
- Packaged agent skills that provide domain context and safety guidance
- Built-in human-in-the-loop verification for sensitive actions
What your agent can do
The command-line tool supports the following Google Workspace services and actions. For the full list of commands, see Complete command reference.
| Service | Actions | Required project services |
|---|---|---|
| Google Calendar | List calendars and events, search events, suggest free meeting times, and create, update, respond to, or delete events. |
calendar-json.googleapis.com,
calendarmcp.googleapis.com
|
| Google Chat | Find spaces, direct messages, and group chats, read and search messages, and send messages. Sending messages requires a Google Workspace account and a configured Google Chat app. |
chat.googleapis.com,
chatmcp.googleapis.com
|
| Google Docs | Read document content and structure, and apply batch edits to documents. |
docs.googleapis.com,
docsmcp.googleapis.com
|
| Google Drive | Search, list, read, and download files, inspect metadata and sharing permissions, create or copy files, and upload local files or new file revisions. |
drive.googleapis.com,
drivemcp.googleapis.com
|
| Gmail | Search and read threads and messages, list and create drafts and replies, manage labels, and move messages or threads to or from Trash and Spam. |
gmail.googleapis.com,
gmailmcp.googleapis.com
|
| The People API, in Developer Preview | View your profile, search personal contacts, and search your organization's directory. Directory search requires a Google Workspace account. | people.googleapis.com |
| Google Sheets | Read spreadsheets and cell ranges, write values and formulas, insert rows or columns, and apply batch spreadsheet updates. |
sheets.googleapis.com,
sheetsmcp.googleapis.com
|
| Google Slides | Read presentations and individual slides, fetch slide thumbnail images, and apply batch edits to presentations. |
slides.googleapis.com,
slidesmcp.googleapis.com
|
| Google Tasks | List task lists and tasks, view task details, create and update tasks, mark tasks complete or incomplete, and delete or restore tasks. |
tasks.googleapis.com,
tasksmcp.googleapis.com
|
Example agent prompts
After you complete setup and install the agent skills, you can ask your AI agent questions and tasks in plain language, such as:
- "What's on my calendar for the rest of today?"
- "Summarize my unread email from this week and create a draft reply to my manager proposing Tuesday."
- "Find my docs about the Q3 plan and list the open action items."
- "Add the open action items from my Q3 plan doc to my Tasks list."
Prerequisites
Before installing the command-line tool, verify the following requirements:
- An environment running Linux, macOS, or Windows on x86_64 or ARM64.
- A Google Cloud project. To create a project, see Create a Google Cloud project.
- On Linux or macOS,
curlfor the quick-install script, or another HTTP download tool such aswgetfor manual downloads. On Windows, PowerShell.
Depending on your setup, you might also need the following:
- The Google Cloud CLI if you enable services from the command line during manual setup. To install it, see Install the Google Cloud CLI.
- If sending messages in Chat with
gwscli chat send_message, a Google Workspace account and a configured Google Chat app in your Google Cloud project. For setup steps, see Configure the Google Chat API. - If accessing the People API with
gwscli peoplecommands, a Google Cloud project enrolled in the Google Workspace Developer Preview Program.
Install the command-line tool
Install the command-line tool with the quick-install script, or download the prebuilt binary manually for your operating system and CPU architecture.
Quick install
Linux and macOS
curl -fsSL https://dl.google.com/workspace-cli/install.sh | bashInstalls to ~/.local/bin. To change this, set GWSCLI_INSTALL_DIR.
Windows
In PowerShell:
iex ((New-Object Net.WebClient).DownloadString('https://dl.google.com/workspace-cli/install.ps1'))Installs to $HOME\bin and adds it to your user PATH. To change the
install directory, set $env:GWSCLI_INSTALL_DIR.
Manual install
Download the prebuilt binary and documentation assets for your operating system and CPU architecture.
Linux x86_64
Run the following commands to download the Linux x86_64 binary and assets, and make the binary executable:
mkdir -p ~/.gwscli
curl -fsSL https://dl.google.com/workspace-cli/linux/gwscli \
-o /usr/local/bin/gwscli
curl -fsSL https://dl.google.com/workspace-cli/README.md \
-o ~/.gwscli/README.md
curl -fsSL https://dl.google.com/workspace-cli/NOTICES.txt \
-o ~/.gwscli/NOTICES.txt
chmod +x /usr/local/bin/gwscliLinux ARM64
Run the following commands to download the Linux ARM64 binary and assets, and make the binary executable:
mkdir -p ~/.gwscli
curl -fsSL https://dl.google.com/workspace-cli/linux_arm64/gwscli \
-o /usr/local/bin/gwscli
curl -fsSL https://dl.google.com/workspace-cli/README.md \
-o ~/.gwscli/README.md
curl -fsSL https://dl.google.com/workspace-cli/NOTICES.txt \
-o ~/.gwscli/NOTICES.txt
chmod +x /usr/local/bin/gwsclimacOS Apple silicon
Run the following commands to download the macOS binary for Apple silicon, grant execute permissions, and clear the quarantine attribute:
mkdir -p ~/.gwscli
curl -fsSL https://dl.google.com/workspace-cli/macos_silicon/gwscli \
-o /usr/local/bin/gwscli
curl -fsSL https://dl.google.com/workspace-cli/README.md \
-o ~/.gwscli/README.md
curl -fsSL https://dl.google.com/workspace-cli/NOTICES.txt \
-o ~/.gwscli/NOTICES.txt
chmod +x /usr/local/bin/gwscli
xattr -d com.apple.quarantine /usr/local/bin/gwsclimacOS Intel
Run the following commands to download the macOS binary for Intel processors, grant execute permissions, and clear the quarantine attribute:
mkdir -p ~/.gwscli
curl -fsSL https://dl.google.com/workspace-cli/macos_intel/gwscli \
-o /usr/local/bin/gwscli
curl -fsSL https://dl.google.com/workspace-cli/README.md \
-o ~/.gwscli/README.md
curl -fsSL https://dl.google.com/workspace-cli/NOTICES.txt \
-o ~/.gwscli/NOTICES.txt
chmod +x /usr/local/bin/gwscli
xattr -d com.apple.quarantine /usr/local/bin/gwscliWindows x86_64
Run the following commands in PowerShell to download the Windows x86_64
binary and assets. Invoke curl.exe explicitly because curl is an alias
for Invoke-WebRequest in PowerShell:
New-Item -ItemType Directory -Force -Path "$HOME\bin", "$HOME\.gwscli"
curl.exe -fsSL https://dl.google.com/workspace-cli/windows/gwscli.exe `
-o "$HOME\bin\gwscli.exe"
curl.exe -fsSL https://dl.google.com/workspace-cli/README.md `
-o "$HOME\.gwscli\README.md"
curl.exe -fsSL https://dl.google.com/workspace-cli/NOTICES.txt `
-o "$HOME\.gwscli\NOTICES.txt"Windows ARM64
Run the following commands in PowerShell to download the Windows ARM64 binary
and assets. Invoke curl.exe explicitly because curl is an alias for
Invoke-WebRequest in PowerShell:
New-Item -ItemType Directory -Force -Path "$HOME\bin", "$HOME\.gwscli"
curl.exe -fsSL https://dl.google.com/workspace-cli/windows_arm64/gwscli.exe `
-o "$HOME\bin\gwscli.exe"
curl.exe -fsSL https://dl.google.com/workspace-cli/README.md `
-o "$HOME\.gwscli\README.md"
curl.exe -fsSL https://dl.google.com/workspace-cli/NOTICES.txt `
-o "$HOME\.gwscli\NOTICES.txt"If /usr/local/bin requires elevated permissions on Linux or macOS, download
the binary to a writable folder on your PATH, such as ~/.local/bin or
~/bin. On Windows, make sure $HOME\bin is included in your PATH.
Install with an AI agent
If you're working inside an AI coding agent, you can also download the agent installation prompt and ask your agent to follow it:
curl -fsSL -O https://dl.google.com/workspace-cli/INSTALL_PROMPT.mdComplete interactive credential setup and sign-in yourself in your local terminal rather than through your agent.
Verify the installation
After installing the binary, verify that the tool runs:
gwscli versionSet up authentication
The command-line tool uses OAuth 2.0 to authenticate requests. You can authenticate with your own OAuth client ID or supply an existing OAuth access token directly.
Interactive sign-in with gwscli auth login requires a web browser that can
reach localhost on the same machine running the tool. Run interactive sign-in
from your local terminal, or see
Browser redirect requirements for remote and headless
environments.
Option 1: Configure your own OAuth client
To allow the command-line tool to manage tokens and refresh sessions, configure an OAuth client ID in your Google Cloud project. Run these setup steps in your own terminal rather than through an AI agent because setup and sign-in wait for interactive input.
You can configure your credentials using Quick setup: Personal mode for a single-user setup, or follow Manual setup for an existing or multi-user Google Cloud project. After completing either setup path, continue to Sign in to services.
Quick setup: Personal mode
Personal mode in the Google Cloud console creates a single-user OAuth 2.0 client that works only for your Google Account, automatically enables core Google Workspace services, and skips OAuth consent screen setup and app verification.
- Open the Google Cloud console personal mode setup page. This link pre-selects the required Google Workspace services, desktop application type, and agent flag.
- Select your Google Cloud project or create a new personal-mode project.
- Click Create Client and download the client secret JSON file.
Run the interactive setup command:
gwscli auth setupWhen prompted, enter the path to your downloaded client secret JSON file, and enter
Yto confirm the registration.Skip Manual setup and continue to Sign in to services.
Manual setup
If you aren't using personal mode, complete all three manual setup steps in your Google Cloud project before signing in.
Step 1: Enable the required services
Each command group requires enabling both the underlying product API and its
companion *mcp.googleapis.com service in your Google Cloud project,
except people, which uses people.googleapis.com for both.
To enable services only for specific products, pass the service names from the Required project services column in What your agent can do. For example, to enable only Drive:
gcloud services enable --project=PROJECT_ID \
drive.googleapis.com drivemcp.googleapis.comTo enable all supported services at once, run:
gcloud services enable --project=PROJECT_ID \
gmail.googleapis.com drive.googleapis.com docs.googleapis.com \
sheets.googleapis.com slides.googleapis.com calendar-json.googleapis.com \
chat.googleapis.com people.googleapis.com tasks.googleapis.com \
gmailmcp.googleapis.com drivemcp.googleapis.com docsmcp.googleapis.com \
sheetsmcp.googleapis.com slidesmcp.googleapis.com \
calendarmcp.googleapis.com chatmcp.googleapis.com \
tasksmcp.googleapis.comReplace PROJECT_ID with your Google Cloud project ID.
If you plan to send messages in Chat with
gwscli chat send_message, also configure a
Chat app in your Google Cloud project as
described in Configure the Google Chat API.
Step 2: Create a credentials file
Before creating a client ID, make sure you have configured your OAuth consent screen in Google Auth Platform. If your consent screen audience is set to External, add your email address under Audience > Test users so consent isn't refused. For details, see Set up the OAuth consent screen.
- In the Google Cloud console, go to Google Auth Platform > Clients > Create Client.
- In the Application type menu, select Desktop app.
- Enter a Name for the client.
- Select Use this client for an AI-powered agent.
- Click Create and download the JSON credentials file to your local machine.
If you already have a Desktop app OAuth 2.0 client ID, you can select Use this client for an AI-powered agent on that client in Google Auth Platform > Clients, as described in Manage OAuth Clients. If you can't change this setting on an existing client, or if the client also supports non-agent features, create a new client ID for your agent. For detailed credential creation steps, see Create access credentials.
Step 3: Register credentials with the tool
Run the auth setup command and provide the path to your downloaded client
secret file:
gwscli auth setup --oauth_client_file=/path/to/client_secret.jsonThis command removes any prior tokens and configures the new client. Enter Y
when prompted to confirm the registration.
Sign in to services
Authorize access for a specific command, one or more services, read-only
operations, or all supported services. The tool prints an authorization URL and
starts a local listener on http://127.0.0.1:<port>/ to receive the OAuth
callback after you grant consent in your browser.
Authentication is incremental. When you run gwscli auth login again for
additional commands or services, the tool merges the newly granted scopes with
your existing authorized scopes.
To authorize read-only access across all services, add the
--bundleflag:gwscli auth login --bundle=readonlyTo authorize read-only access for a single service, combine the service name with
--bundle=readonly:gwscli auth login chat --bundle=readonlyTo authorize access for an individual action, pass both the service and the command:
gwscli auth login gmail search_threadsTo authorize access for a single service, pass the service name:
gwscli auth login driveTo authorize access for multiple services in a single command, pass the service names separated by spaces:
gwscli auth login chat gmailTo authorize multiple specific commands at once, pass each target in quotes:
gwscli auth login "chat search_messages" "gmail create_draft"To authorize all supported services at once, run:
gwscli auth login
To verify the signed-in account and check the active scopes, run:
gwscli auth statusTo refresh authorized tokens manually, run:
gwscli auth refreshTo log out and revoke active tokens, run:
gwscli auth logoutTo remove your configured OAuth client and reset authentication credentials, run:
gwscli auth resetBrowser redirect requirements
Interactive sign-in requires a machine that can open a web browser and deliver
OAuth redirects to http://127.0.0.1:<port>/. Without extra port forwarding,
gwscli auth login won't complete in the following environments:
- Headless environments without browser access
- Cloud Shell or remote SSH sessions without local port forwarding
- Containerized environments without
localhostport mapping
To authenticate on a remote SSH host or container, forward the dynamic port
printed by gwscli auth login from your local computer to 127.0.0.1:<port>
on the remote host before completing consent in your local browser.
Alternatively, obtain an access token separately and pass it with
--oauth_token as described in
Option 2: Pass an existing OAuth token.
Option 2: Pass an existing OAuth token
If your platform already manages Google OAuth 2.0 tokens, pass an access token
directly on any command using the global --oauth_token flag:
gwscli --oauth_token="$ACCESS_TOKEN" calendar list_eventsWhen you pass --oauth_token, the command-line tool doesn't prompt for consent
or refresh expired tokens. Verify the following requirements for the token:
Required scopes: The token must include the OAuth scopes required by the command. To check which scopes a command needs before calling it, pass
--show-scopes:gwscli calendar list_events --show-scopesYou can also print only the comma-separated minimal scopes with
auth login --print-scope-only:gwscli auth login --print-scope-only calendar list_eventsEnabled project services: The Google Cloud project that owns the issuing credentials must have the required services enabled, as shown in Step 1: Enable the required services.
Supported credential types: User-delegated OAuth tokens must come from an OAuth client ID with Use this client for an AI-powered agent selected. Access tokens minted by a service account with domain-wide delegation are also accepted.
Discover commands and schemas
The tool uses a standard command syntax:
gwscli <service> <action> [flags]Because the command-line tool discovers services, actions, and schemas
dynamically from the backend at runtime, updates might not be backward
compatible. AI agents and developers should inspect --help and --schema at
runtime rather than hardcoding command signatures in static scripts.
List available services
To display all supported services and utility commands, run the help command:
gwscli --helpList service actions
To list available actions for a specific service, pass the service name with the help flag:
gwscli drive --helpInspect action parameters and flags
To inspect the parameters, flags, and output format summary for an action, run the action with the help flag:
gwscli drive list_recent_files --helpTo include the supported and recommended minimal OAuth scopes in the help
output, add --show-scopes:
gwscli drive list_recent_files --show-scopesInspect the JSON schema
To print the full JSON output schema and field definitions without executing
the action, pass the --schema flag:
gwscli drive search_files --schemaParse command output and transfer files
The command-line tool prints results directly to standard output.
Structured JSON: Commands that return lists, files, or event records output valid JSON. You can filter and format the output using tools like
jq:gwscli drive search_files \ --query="title contains 'Quarterly'" \ | jq '.files[] | {id: .id, title: .title}'Document content: Commands that fetch document contents also return JSON. For example,
docs read_docoutputs the document JSON representation with text and structural elements, anddrive read_file_contentreturns JSON with afileContentstring field containing the formatted plain text or Markdown:gwscli drive read_file_content --fileId="FILE_ID" \ | jq -r '.fileContent'Download files: To download binary files or export Google Workspace documents directly to a local path, use
drive download_file_content:gwscli drive download_file_content --fileId="FILE_ID" \ --destinationPath="./report.pdf" --exportMimeType="application/pdf"Omit
--exportMimeTypewhen downloading binary files such as PDFs or images. When exporting Docs, Sheets, or Slides files, pass a supported MIME type from Export MIME types for Google Workspace documents, or rungwscli drive download_file_content --helpto inspect the flag details.Upload local files and revisions: To upload a local file from disk as a new Drive file using resumable upload, pass
--filePathtodrive create_file:gwscli drive create_file --filePath="./report.pdf" \ --title="Quarterly Report"To upload a new content revision for an existing non-Google Workspace file in Drive, pass
--filePathtodrive upload_file_revision:gwscli drive upload_file_revision --fileId="FILE_ID" \ --filePath="./report-v2.pdf"
Install packaged agent skills
The tool includes pre-packaged agent skills that teach AI coding agents how to discover commands, handle authentication and confirmation prompts safely, and parse command output.
To list all available packaged agent skills embedded in the tool, run:
gwscli skills listTo install the agent skills into your agent's skill discovery folder, pass
--dir. For example, use ~/.agents/skills for agents that read the shared
skills folder, or ~/.claude/skills for Claude Code:
gwscli skills install --dir ~/.agents/skillsWhenever you update the gwscli binary, also refresh your installed skills as
described in Update the tool and agent skills.
Update the tool and agent skills
The command-line tool doesn't auto-update in the background. Check the Google Workspace CLI release notes periodically for new releases, and compare against your installed version:
gwscli versionTo update the binary, re-run the quick-install script or download the latest binary for your platform using the manual install steps. Your existing OAuth client configuration and cached tokens are preserved across binary updates.
Refresh packaged agent skills
Packaged agent skills are embedded inside the gwscli binary. After updating
the binary, refresh your installed skills with --overwrite so your agent
receives the latest command guidance and version metadata:
gwscli skills install --dir ~/.agents/skills --overwritePassing --overwrite replaces only the gwscli skill subdirectories in the
target folder and leaves other unrelated skills untouched. If you customized
the gwscli skill files directly, back them up or install to a temporary
folder first to compare changes before running --overwrite. After refreshing
skills, make sure your agent loads the updated skill files.
Complete command reference
Because service commands are discovered dynamically at runtime, available
commands and flags can change across releases. Run
gwscli <service> <action> --help to view the current flags and output format
for any command.
Service commands
In the Access column below, Read-only commands only read data and are
included when you sign in with --bundle=readonly. Write commands create,
modify, or delete data.
Service
Command
Description
Access
Calendar
calendar list_calendarsList calendars that you own or subscribe to.
Read-only
Calendar
calendar list_eventsList events on a calendar matching time or text filters.
Read-only
Calendar
calendar get_eventGet details for a single event.
Read-only
Calendar
calendar search_eventsSearch events on your primary calendar.
Read-only
Calendar
calendar suggest_timeSuggest available times across one or more calendars.
Read-only
Calendar
calendar create_eventCreate an event on a calendar.
Write
Calendar
calendar update_eventUpdate an existing event on a calendar.
Write
Calendar
calendar respond_to_eventRespond to an event invitation.
Write
Calendar
calendar delete_eventDelete an event from a calendar.
Write
Chat
chat search_conversationsFind spaces, direct messages, and group chats.
Read-only
Chat
chat list_messagesRead messages from a conversation in Markdown format.
Read-only
Chat
chat search_messagesSearch messages across spaces or within a conversation.
Read-only
Chat
chat send_message
Send a message to a conversation. Requires a
Google Workspace account and a configured
Chat app.
Write
Docs
docs read_docRead the JSON representation of a document.
Read-only
Docs
docs update_docApply batch updates to edit a document.
Write
Drive
drive search_filesSearch files using structured query terms.
Read-only
Drive
drive list_recent_filesList recent files.
Read-only
Drive
drive get_file_metadataGet metadata details for a file.
Read-only
Drive
drive get_file_permissionsList access permissions for a file.
Read-only
Drive
drive read_file_contentRead a text representation of a file and optional comments.
Read-only
Drive
drive download_file_contentDownload a binary file or export a document to local disk.
Read-only
Drive
drive create_fileCreate a file or folder, or upload a local file from disk.
Write
Drive
drive upload_file_revision
Upload a new content revision for an existing
non-Google Workspace file.
Write
Drive
drive copy_fileCopy an existing file.
Write
Gmail
gmail search_threadsSearch or list email threads.
Read-only
Gmail
gmail get_threadRead a full email thread and its messages.
Read-only
Gmail
gmail get_messageRead a single email message by ID.
Read-only
Gmail
gmail list_draftsList draft emails.
Read-only
Gmail
gmail get_draftRead a draft email by ID.
Read-only
Gmail
gmail list_labelsList system and user labels.
Read-only
Gmail
gmail create_draftCreate a draft email or reply without sending it.
Write
Gmail
gmail create_labelCreate a label.
Write
Gmail
gmail label_threadAdd labels to a thread.
Write
Gmail
gmail label_messageAdd labels to a single message.
Write
Gmail
gmail unlabel_threadRemove labels from a thread.
Write
Gmail
gmail unlabel_messageRemove labels from a single message.
Write
Gmail
gmail update_message_labelsAdd and remove labels on a message in one step.
Write
Gmail
gmail trash_threadMove a thread to Trash.
Write
Gmail
gmail trash_messageMove a single message to Trash.
Write
Gmail
gmail untrash_threadRestore a thread from Trash.
Write
Gmail
gmail untrash_messageRestore a single message from Trash.
Write
Gmail
gmail mark_thread_spamMark a thread as spam.
Write
Gmail
gmail mark_message_spamMark a single message as spam.
Write
Gmail
gmail unmark_thread_spamUnmark a thread as spam.
Write
Gmail
gmail unmark_message_spamUnmark a single message as spam.
Write
Gmail
gmail apply_sensitive_thread_label
Move a thread to Trash or Spam. Prefer
trash_thread or
mark_thread_spam.
Write
Gmail
gmail apply_sensitive_message_label
Move a message to Trash or Spam. Prefer
trash_message or
mark_message_spam.
Write
People API
people get_user_profile
Get your profile name and email address. Available in
Developer Preview.
Read-only
People API
people search_contacts
Search your personal contacts. Available in
Developer Preview.
Read-only
People API
people search_directory_people
Search your organization's directory. Requires a
Google Workspace account. Available in
Developer Preview.
Read-only
Sheets
sheets get_spreadsheetRead spreadsheet metadata and content.
Read-only
Sheets
sheets get_valuesRead values from a range of cells.
Read-only
Sheets
sheets update_valuesWrite values to a range of cells.
Write
Sheets
sheets update_formulasWrite formulas to a range of cells.
Write
Sheets
sheets insert_dimensionInsert rows or columns in a sheet.
Write
Sheets
sheets update_spreadsheetApply batch updates to a spreadsheet.
Write
Slides
slides read_presentationRead the JSON representation of a presentation.
Read-only
Slides
slides read_slide_pageRead a single slide from a presentation.
Read-only
Slides
slides read_slide_page_thumbnailGet the thumbnail image URL and dimensions for a slide.
Read-only
Slides
slides update_presentationApply batch updates to edit a presentation.
Write
Tasks
tasks list_task_listsList your task lists.
Read-only
Tasks
tasks list_tasksList tasks across one or all task lists.
Read-only
Tasks
tasks get_taskGet details for a single task by ID.
Read-only
Tasks
tasks create_taskCreate a task in a task list.
Write
Tasks
tasks update_taskUpdate an existing task.
Write
Tasks
tasks complete_taskMark a task as complete.
Write
Tasks
tasks uncomplete_taskMark a task as incomplete.
Write
Tasks
tasks delete_taskDelete a task.
Write
Tasks
tasks undelete_taskRestore a deleted task.
Write
Utility commands
The following built-in commands manage local authentication, agent skills, telemetry settings, and version details:
| Command | Description |
|---|---|
auth setup |
Register an OAuth 2.0 client secret JSON file. |
auth login |
Sign in and authorize scopes for services or commands. |
auth status |
Display granted OAuth scopes and the signed-in user profile. |
auth refresh |
Force a manual refresh of cached OAuth tokens. |
auth logout |
Revoke active OAuth tokens and clear cached session state. |
auth reset |
Sign out and remove the registered OAuth client credentials. |
skills list |
List embedded agent skills packaged with the binary. |
skills install |
Install embedded agent skills into a target directory. |
logging on |
Enable usage telemetry in your local configuration. |
logging off |
Disable usage telemetry in your local configuration. |
logging status |
Display whether usage telemetry is currently enabled. |
privacy |
Print the Google Privacy Policy URL. |
terms |
Print the Google APIs Terms of Service URL. |
version |
Print the installed gwscli version. |
Security and governance
When using the command-line tool directly or through AI agents, follow these security and governance practices.
Protect against prompt injection
Language models can encounter untrusted text in email bodies, shared files, or external web pages that carry hidden instructions.
- Use the command-line tool only with AI agents and workflows that you trust.
- Start with read-only access and grant write scopes only for the services you need.
- Don't feed unverified documents or messages from unknown senders into agent prompts.
- Review actions taken by your agent and ensure agents don't forward sensitive contents to external destinations.
Screen requests and responses
Because the command-line tool calls the *mcp.googleapis.com service endpoints
using your Google Cloud project, you can configure project-level security
filters in Google Cloud to screen tool inputs and responses for prompt
injection, sensitive data, or harmful content. Any MCP floor settings
configured on your Google Cloud project apply to gwscli requests as
well. For setup steps, see
Configure security for Google Workspace MCP servers.
Automate in headless environments safely
The auth login and auth setup commands wait for interactive browser or
terminal input and block indefinitely in unattended environments. Don't invoke
interactive setup or sign-in commands in automated background jobs or headless
scripts.
In headless environments, pre-authorize credentials beforehand or pass
externally managed access tokens with --oauth_token. If an automated agent
encounters an authentication or scope error, stop execution and surface the
error rather than attempting interactive sign-in.
Human-in-the-loop verification
Google Workspace enforces user and administrator approval policies for sensitive actions, such as sending messages, sharing content externally, trashing items, or deleting data. Other write actions run without asking once you've granted the required OAuth scopes, so always review what your agent does.
When an action requires confirmation, the command-line tool pauses, prints a prompt to standard error, and waits for an approval choice on standard input:
Allow this app to use send_message?
approval_choice
(Options: Allow once, Always allow this tool, Don't allow):
The command-line tool accepts choice identifiers such as ALLOW_ONCE,
ALLOW_TOOL_ALWAYS, or DENY_ONCE on standard input. Sticky options such as
ALLOW_TOOL_ALWAYS appear only in an interactive terminal when permitted by
policy for the action or target resource. When an AI agent runs the command,
the agent must prompt the user for explicit confirmation and write the user's
chosen identifier to standard input, or a human running the tool directly can
type the choice in the terminal.
Manage usage telemetry
Usage telemetry sends diagnostic and command-execution metadata to Google to help monitor reliability and improve the command-line tool. Google handles collected telemetry data in accordance with the Google Privacy Policy.
Usage telemetry is enabled by default. You can check the current setting or turn usage telemetry off or on persistently at any time:
gwscli logging off # Turn off usage telemetry
gwscli logging status # Show the current setting
gwscli logging on # Turn usage telemetry back onTo disable usage telemetry for a single terminal session or automated
environment without modifying your configuration file, set the
GWSCLI_TELEMETRY_ENABLED environment variable to 0, false, off, or
no:
export GWSCLI_TELEMETRY_ENABLED=0When usage telemetry is enabled, each command invocation records only the following operational signals:
- Command metadata: The target service and action name, the names of flags passed to the command, and the number of positional arguments
- Environment metadata: The tool version, build variant, operating system, and CPU architecture
- Execution diagnostics: Execution status, command duration, HTTP status codes, enumerated error codes or Go error types, and crash stack traces
The tool never collects flag values, OAuth tokens, search queries, document IDs, email addresses, or resource content.
Telemetry events are sent directly to Google when a command finishes and aren't
written to a local log file. You can inspect whether telemetry is active by
running gwscli logging status or by reading the telemetry_enabled field in
your local gwscli/config.json configuration file:
- Linux:
~/.config/gwscli/config.json - macOS:
~/Library/Application Support/gwscli/config.json - Windows:
%AppData%\gwscli\config.json
To print the Google Privacy Policy or
Google APIs Terms of Service URLs from the terminal, run
gwscli privacy or gwscli terms. Usage is also subject to the
Google Workspace user data and developer policy.
Troubleshooting
Use the following table to resolve common setup, authentication, and execution issues:
| Issue | Resolution |
|---|---|
insufficient authentication scopes or missing cached token
|
Run gwscli <service> <action> --show-scopes or
gwscli auth login --print-scope-only <service>
<action> to check the required scopes. If using an OAuth
client, inspect active scopes with gwscli auth status and
run gwscli auth login <service> <action> in
your local terminal. If passing --oauth_token, mint a new
access token that includes the required scopes.
|
| Sign-in doesn't finish over SSH or in a remote shell |
Run gwscli auth login on a local machine with a browser,
forward the printed 127.0.0.1:<port> over SSH, or
pass a token with --oauth_token. See
Browser redirect requirements.
|
| Service not enabled or permission denied |
Enable the required services from
Step 1: Enable the required services in the
Google Cloud project that owns your OAuth client or that issued
the token passed to --oauth_token. For user-delegated
OAuth clients, verify that
Use this client for an AI-powered agent is selected,
and add your account under Test users if your consent
screen audience is External.
|
gwscli chat send_message fails |
Configure a Chat app in your Google Cloud project as described in Configure the Chat API . Sending messages requires a Google Workspace account and isn't supported for personal Google Accounts. |
| Command pauses and waits for input | The action requires human-in-the-loop confirmation on standard error. Review the prompt and provide an approval choice on standard input. See Human-in-the-loop verification. |