Glean CLI
The glean command-line tool provides authenticated access to your company's Glean instance. It can search documents, chat with Glean Assistant, look up people and teams, manage collections, and more.
When to Use
Use the Glean CLI when the user:
- Asks about internal documents, policies, wikis, or company knowledge
- Wants to find people, teams, or org structure
- Needs to search across enterprise data sources (Confluence, Jira, Google Drive, Slack, etc.)
- Asks questions that require company-specific context
- Wants to manage Glean resources (collections, shortcuts, pins, announcements)
Installation
brew install gleanwork/tap/glean-cli
Authentication
# Browser-based OAuth (interactive — recommended)
glean auth login
# Verify credentials
glean auth status
# CI/scripting (no interactive setup needed)
export GLEAN_API_TOKEN=your-token
export GLEAN_SERVER_URL=<your Glean server URL>
Credentials resolve in this order: environment variables → system keyring → ~/.glean/config.json.
CLI Syntax
glean <command> [subcommand] [flags]
Global Flags
| Flag |
Description |
| --output |
json (default), ndjson (one result per line), text |
| --fields |
Dot-path field projection (e.g. results.document.title,results.document.url) |
| --json |
Complete JSON request body (overrides all other flags) |
| --dry-run |
Print request body without sending |
Schema Introspection
Always call glean schema <command> before invoking a command you haven't used before.
glean schema | jq '.commands' # list all commands
glean schema search | jq '.flags' # flags for search
Security Rules
- Never output API tokens or secrets directly
- Always use --dry-run before write/delete operations in automated pipelines
- Prefer environment variables over config files for CI/CD
Error Handling
All errors go to stderr; stdout contains only structured output.
Exit code 0 = success, non-zero = error.
Available Commands
| Command |
Description |
| glean activity |
Report user activity and feedback. Subcommands: report, feedback. |
| glean agents |
Manage and run Glean agents. Subcommands: list, get, schemas, run. |
| glean announcements |
Manage Glean announcements. Subcommands: create, update, delete. |
| glean answers |
Manage Glean answers. Subcommands: list, get, create, update, delete. |
| glean api |
Make a raw authenticated HTTP request to any Glean REST API endpoint. |
| glean chat |
Have a conversation with Glean AI. Streams response to stdout. |
| glean collections |
Manage Glean collections. Subcommands: create, delete, update, add-items, delete-item. |
| glean documents |
Retrieve and summarize Glean documents. Subcommands: get, get-by-facets, get-permissions, summarize. |
| glean entities |
List and read Glean entities and people. Subcommands: list, read-people. |
| glean insights |
Retrieve Glean usage insights. Subcommands: get. |
| glean messages |
Retrieve Glean messages. Subcommands: get. |
| glean pins |
Manage Glean pins. Subcommands: list, get, create, update, remove. |
| glean search |
Search for content in your Glean instance. Results are JSON. |
| glean shortcuts |
Manage Glean shortcuts (go-links). Subcommands: list, get, create, update, delete. |
| glean tools |
List and run Glean tools. Subcommands: list, run. |
| glean verification |
Manage document verification. Subcommands: list, verify, remind. |
Previously installed per-command skills?
Earlier versions of this project shipped one skill per command (glean-cli-search, glean-cli-pins, etc.). Those are superseded by this consolidated skill. If you still have them installed, remove them with:
npx -y skills remove -g -y \
glean-cli-activity glean-cli-agents glean-cli-announcements \
glean-cli-answers glean-cli-api glean-cli-chat glean-cli-collections \
glean-cli-documents glean-cli-entities glean-cli-insights \
glean-cli-messages glean-cli-pins glean-cli-search glean-cli-shortcuts \
glean-cli-tools glean-cli-verification
1---2name: glean-cli3description: Glean CLI: access company knowledge, search documents, chat with Glean Assistant, look up people, and manage enterprise content. Use when the user asks about internal docs, company information, people, policies, or enterprise data.4---56# Glean CLI78The `glean` command-line tool provides authenticated access to your company's Glean instance. It can search documents, chat with Glean Assistant, look up people and teams, manage collections, and more.910## When to Use1112Use the Glean CLI when the user:1314- Asks about internal documents, policies, wikis, or company knowledge15- Wants to find people, teams, or org structure16- Needs to search across enterprise data sources (Confluence, Jira, Google Drive, Slack, etc.)17- Asks questions that require company-specific context18- Wants to manage Glean resources (collections, shortcuts, pins, announcements)1920## Installation2122```bash23brew install gleanwork/tap/glean-cli24```2526## Authentication2728```bash29# Browser-based OAuth (interactive — recommended)30glean auth login3132# Verify credentials33glean auth status3435# CI/scripting (no interactive setup needed)36export GLEAN_API_TOKEN=your-token37export GLEAN_SERVER_URL=<your Glean server URL>38```3940Credentials resolve in this order: environment variables → system keyring → ~/.glean/config.json.4142## CLI Syntax4344```bash45glean <command> [subcommand] [flags]46```4748### Global Flags4950| Flag | Description |51|------|-------------|52| --output <FORMAT> | json (default), ndjson (one result per line), text |53| --fields <PATHS> | Dot-path field projection (e.g. results.document.title,results.document.url) |54| --json <PAYLOAD> | Complete JSON request body (overrides all other flags) |55| --dry-run | Print request body without sending |5657## Schema Introspection5859Always call `glean schema <command>` before invoking a command you haven't used before.6061```bash62glean schema | jq '.commands' # list all commands63glean schema search | jq '.flags' # flags for search64```6566## Security Rules6768- **Never** output API tokens or secrets directly69- **Always** use --dry-run before write/delete operations in automated pipelines70- Prefer environment variables over config files for CI/CD7172## Error Handling7374All errors go to stderr; stdout contains only structured output.75Exit code 0 = success, non-zero = error.7677## Available Commands7879| Command | Description |80|---------|-------------|81| [glean activity](reference/activity.md) | Report user activity and feedback. Subcommands: report, feedback. |82| [glean agents](reference/agents.md) | Manage and run Glean agents. Subcommands: list, get, schemas, run. |83| [glean announcements](reference/announcements.md) | Manage Glean announcements. Subcommands: create, update, delete. |84| [glean answers](reference/answers.md) | Manage Glean answers. Subcommands: list, get, create, update, delete. |85| [glean api](reference/api.md) | Make a raw authenticated HTTP request to any Glean REST API endpoint. |86| [glean chat](reference/chat.md) | Have a conversation with Glean AI. Streams response to stdout. |87| [glean collections](reference/collections.md) | Manage Glean collections. Subcommands: create, delete, update, add-items, delete-item. |88| [glean documents](reference/documents.md) | Retrieve and summarize Glean documents. Subcommands: get, get-by-facets, get-permissions, summarize. |89| [glean entities](reference/entities.md) | List and read Glean entities and people. Subcommands: list, read-people. |90| [glean insights](reference/insights.md) | Retrieve Glean usage insights. Subcommands: get. |91| [glean messages](reference/messages.md) | Retrieve Glean messages. Subcommands: get. |92| [glean pins](reference/pins.md) | Manage Glean pins. Subcommands: list, get, create, update, remove. |93| [glean search](reference/search.md) | Search for content in your Glean instance. Results are JSON. |94| [glean shortcuts](reference/shortcuts.md) | Manage Glean shortcuts (go-links). Subcommands: list, get, create, update, delete. |95| [glean tools](reference/tools.md) | List and run Glean tools. Subcommands: list, run. |96| [glean verification](reference/verification.md) | Manage document verification. Subcommands: list, verify, remind. |979899## Previously installed per-command skills?100101Earlier versions of this project shipped one skill per command (`glean-cli-search`, `glean-cli-pins`, etc.). Those are superseded by this consolidated skill. If you still have them installed, remove them with:102103```bash104npx -y skills remove -g -y \105 glean-cli-activity glean-cli-agents glean-cli-announcements \106 glean-cli-answers glean-cli-api glean-cli-chat glean-cli-collections \107 glean-cli-documents glean-cli-entities glean-cli-insights \108 glean-cli-messages glean-cli-pins glean-cli-search glean-cli-shortcuts \109 glean-cli-tools glean-cli-verification110```