Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gemini-extension-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@googleworkspace/cli": patch
---

Fix Gemini extension installation issue by removing redundant authentication settings and update the documentation.
6 changes: 6 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

The `gws` CLI provides dynamic access to Google Workspace APIs (Drive, Gmail, Calendar, Sheets, Admin, etc.) by parsing Discovery Documents at runtime.

## Rules of Engagement for Agents

* **Schema Discovery:** *If you don't know the exact JSON payload structure, run `gws schema <resource>.<method>` first to inspect the schema before executing.*
* **Context Window Protection:** *Workspace APIs (like Drive and Gmail) return massive JSON blobs. ALWAYS use field masks when listing or getting resources by appending `--params '{"fields": "id,name"}'` to avoid overwhelming your context window.*
* **Dry-Run Safety:** *Always use the `--dry-run` flag for mutating operations (create, update, delete) to validate your JSON payload before actual execution.*

## Core Syntax

```bash
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,33 @@ The `gws-shared` skill includes an `install` block so OpenClaw auto-installs the
</details>


## Gemini CLI Extension

### 1. Installation

1. Authenticate the CLI first:
```bash
gws setup
```

2. Install the extension into the Gemini CLI:
```bash
gemini extensions install https://github.com/googleworkspace/cli
```

Installing this extension gives your Gemini CLI agent direct access to all `gws` commands and 40+ Google Workspace agent skills. Because `gws` handles its own authentication securely, you simply need to authenticate your terminal once prior to using the agent, and the extension will automatically inherit your credentials.

### 2. How to Improve `gws` as a Gemini CLI Extension

Because `gws` dynamically builds its commands from Google's Discovery APIs, it is incredibly powerful for AI. However, relying purely on the model writing `bash` commands can lead to hallucinations or context-window bloat. Here is how you can optimize it specifically for the Gemini CLI agent:

#### A. Optimize the Context File for Agent Autonomy
The file specified in `"contextFileName": "CONTEXT.md"` (which is canonically named `GEMINI.md` in Gemini CLI extensions) is injected directly into the Gemini agent's system prompt. Use this file to give the agent strict "rules of engagement":
* **Schema Discovery:** *"If you don't know the exact JSON payload structure, run `gws schema <resource>.<method>` first to inspect the schema before executing."*
* **Context Window Protection:** *"Workspace APIs (like Drive and Gmail) return massive JSON blobs. ALWAYS use field masks when listing or getting resources by appending `--params '{"fields": "id,name"}'` to avoid overwhelming your context window."*
* **Dry-Run Safety:** *"Always use the `--dry-run` flag for mutating operations (create, update, delete) to validate your JSON payload before actual execution."*


## Advanced Usage

### Multipart Uploads
Expand Down
24 changes: 0 additions & 24 deletions gemini-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,11 @@
"description": "CLI tool for managing Google Workspace resources dynamically using Discovery APIs.",
"contextFileName": "CONTEXT.md",
"settings": [
{
"name": "Credentials File",
"description": "Path to the Google Workspace authorized user credentials or service account JSON file.",
"envVar": "GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE",
"sensitive": false
},
{
"name": "OAuth Client ID",
"description": "Client ID for OAuth authentication.",
"envVar": "GOOGLE_WORKSPACE_CLI_CLIENT_ID",
"sensitive": false
},
{
"name": "OAuth Client Secret",
"description": "Client Secret for OAuth authentication.",
"envVar": "GOOGLE_WORKSPACE_CLI_CLIENT_SECRET",
"sensitive": true
},
{
"name": "Sanitize Template",
"description": "Resource name of the Model Armor template to use for sanitization (e.g., projects/P/locations/L/templates/T).",
"envVar": "GOOGLE_WORKSPACE_CLI_SANITIZE_TEMPLATE",
"sensitive": false
},
{
"name": "Impersonated User",
"description": "Email address of the user to impersonate (requires Domain-Wide Delegation).",
"envVar": "GOOGLE_WORKSPACE_CLI_IMPERSONATED_USER",
"sensitive": false
}
]
}
Loading