Detailed reference for every slash command in Glean Code. Looking for a quick overview? See the README's Commands at a glance.
Commands marked Mock mode below read from the built-in fake corpus when no credentials are configured — seventy interlinked documents spread evenly across five faux datasources (gdrive, confluence, jira, github, slack — 14 each). Full inventory and the people roster: Mock Corpus.
Show help for a specific command, or list every available command grouped by category.
/help [command]
| Parameter | Description |
|---|---|
command |
Optional. Command name without the leading /. Omit to list all commands. |
/help
/help search
/help agents.run
Output — Without an argument: a grouped list of all commands with one-line summaries. With a command name: usage signature, parameter table, examples, and the underlying REST endpoint.
Endpoint — (local)
Show the current connection state, active mode, configured instance, and any impersonation in effect.
/status
/status
Output — A summary box showing: mode (live / mock / auto), instance host, token presence, act-as email if set, and the active chat thread id.
Endpoint — (local)
Run a full health check: validates config, tests DNS resolution, TCP connectivity, and performs a live auth probe against the search endpoint.
/doctor
/doctor
Output — A line per check (config, url shape, dns, tcp, auth probe) with a pass/fail status and detail message. Useful for diagnosing connectivity or token problems.
Endpoint — (local checks + POST /rest/api/v1/search probe)
Sign in to Glean with browser OAuth, or store an API token. OAuth uses Authorization Code + PKCE and Dynamic Client Registration when no static client ID is configured.
/login <hostname-or-instance-id> [--client-id <id>] [--port <n>] [--no-browser] [--act-as <email>]
| Parameter | Description |
|---|---|
hostname-or-instance-id |
A backend hostname such as acme-be.glean.com, or an instance ID such as acme. IDs map to <id>-be.glean.com. |
--instance |
Alternative named form of the hostname or instance ID. |
--client-id |
Optional static OAuth client ID. DCR is used when omitted. |
--port |
Optional fixed localhost callback port for redirect-URI allowlisting. |
--no-browser |
Print the OAuth authorize URL instead of opening a browser. |
--token |
Legacy API-token login. Supplying it skips OAuth. |
--act-as |
Optional. Email address to impersonate via X-Glean-ActAs. |
/login acme
/login acme-be.glean.com
/login --instance acme-be.glean.com --no-browser
/login --instance acme-be.glean.com --token glean_tok_xxx
Output — OAuth opens the browser and waits for the localhost callback, then stores OAuth tokens in ~/.gleancode/auth.json. Token login stores the API token in ~/.gleancode/config.json.
Endpoint — (local, OAuth Authorization Code + PKCE or Authorization header)
Clear stored credentials and revert to mock mode.
/logout
/logout
Output — Confirms credentials removed.
Mock mode — This is what /logout reverts to: with no token, searches answer from the mock corpus. It clears both API-token and OAuth credentials.
Endpoint — (local)
Open the configured Glean instance in the default web browser. Strips the -be suffix from the instance host, so acme-be.glean.com opens https://acme.glean.com.
/open [path] [--path <path>] [--print]
| Parameter | Description |
|---|---|
path |
Optional path to append, positionally. e.g. search or /docs/123. A leading / is added if missing. |
--path |
Same as the positional path. Either form works. |
--print |
Print the URL instead of launching a browser. Useful over SSH. --dry-run does the same. |
/open
/open search
/open /docs/123
/open --print
Output — The URL being opened, then the browser launch. With --print: just the URL. Errors if no instance is configured.
Endpoint — (local)
View or update individual configuration keys. Changes are persisted to ~/.gleancode/config.json.
/config [get <key> | set <key> <value> | list]
| Subcommand | Description |
|---|---|
list |
Print the full config as key/value pairs. |
get <key> |
Print the value of a single key. |
set <key> <value> |
Update a key. See the Config keys section for valid keys and values. |
/config list
/config get mode
/config set mode live
/config set default_page_size 20
/config set indexing_token glean_idx_xxx
/config set mock_corpus_path ~/demo-corpus.json
Output — For list and get: the value(s). For set: a confirmation message.
Mock mode — mock_corpus_path points offline mode at your own JSON corpus instead of the built-in Acme one; see Bring your own corpus. Unset it with /config set mock_corpus_path "".
Endpoint — (local, ~/.gleancode/config.json)
Quickly switch the API mode without editing config.
/mode <live|mock|auto>
| Value | Description |
|---|---|
live |
Force all API calls to the real Glean backend. |
mock |
Force all calls to return local fake data (no network). |
auto |
Use live if credentials are present, otherwise fall back to mock. |
/mode auto
/mode mock
/mode live
Output — Confirms the new mode.
Endpoint — (local)
Inspect, configure, and run the bundled MCP server without leaving the REPL.
/mcp <status|config|start|stop> [client] [--url] [--stdio] [--name <key>] [--port <n>] [--host <addr>] [--transport <t>] [--mock]
| Subcommand | Description |
|---|---|
status |
Installed mcp version and whether it can run the server, plus the running server's pid, URL, uptime, and mode. The default when no subcommand is given. |
config |
Print the JSON block to paste into a client. Optional client name: claude-code, claude-desktop, cursor. |
start |
Run the server detached over HTTP and record where it landed. |
stop |
Terminate the server start launched. |
| Flag | Description |
|---|---|
--url |
config: emit the URL form pointing at the running server. |
--stdio |
config: force the command form even while a server is running. |
--name |
config: key under mcpServers. Default glean. |
--port |
start: bind port. Default 8787. |
--host |
start: bind address. Default 127.0.0.1. |
--transport |
start: streamable-http (default) or sse. |
--mock |
start: serve the built-in corpus. Implied when the REPL is in mock mode. |
/mcp status
/mcp config claude-code
/mcp config --name glean-cli
/mcp start --port 9000
/mcp config --url
/mcp stop
Output — status prints a key/value table; config prints JSON; start and stop confirm with the pid and URL.
start cannot use stdio, by design. stdio is the transport an MCP client spawns for itself over a pipe pair — started from the REPL it would have no client on the other end. /mcp start therefore runs streamable-http (or sse), which a client attaches to by URL. For the ordinary setup, use /mcp config and let the client spawn the server. See docs/MCP.md.
Name collisions. The emitted block keys the server as glean under mcpServers. Glean's own hosted MCP server would naturally be registered under that name too, and pasting over it silently swaps the toolset with no error. Use --name glean-cli to run both side by side.
Endpoint — (local — spawns glean_mcp.py)
Map what you have investigated: captured chats, the documents they cited, and the connections between them. Full guide: docs/FLOW_MAPPER.md.
/flow <status|enrich|link|show|timeline|purge> [--docs <n>] [--links <n>] [--limit <n>] [--min-score <f>] [--output <file>] [--print] [--all] [--older-than <days>]
| Subcommand | Description |
|---|---|
status |
Capture setting, database path and size, and what has been recorded. The default when no subcommand is given. |
enrich |
Fetch document text for captured citations, via /getdocuments then /summarize. Required before linking. |
link |
Find document-to-document and cross-session links. |
show |
Draw the captured investigations as a vertical rail, with connections branching off it. |
timeline |
Write a self-contained HTML timeline and open it. |
purge |
Delete captured data, after confirming. |
| Flag | Description |
|---|---|
--docs |
show: documents listed per session before the rest are counted. Default 6. |
--links |
show: connections drawn per session before the rest are counted. Default 3. |
--limit |
enrich: documents to fetch in one run. Default 50. |
--min-score |
link: phrase-link threshold, 0–1. Default 0.45. Higher is stricter. |
--output |
timeline: where to write the HTML. Default a temp file. |
--print |
timeline: write without opening a browser. |
--all |
purge: every instance and mode, not just the current one. |
--older-than |
purge: only sessions older than this many days. |
/flow status
/flow enrich
/flow link --min-score 0.6
/flow show
/flow show --docs 3
/flow timeline --output ~/flow.html
/flow purge --older-than 30
Output — show draws each session as a node on a vertical rail, with its questions, sources, and any connection branching off in yellow:
── flow: acme-be.glean.com · mock ────────────────────────────────────────────
●─ 1 what happened in the checkout incident?
│ Tue 18 Aug 2026, 22:05 · 4 turns · 6 sources
│ ↳ who owned the fix?
│
│ ▪ confluence Postmortem: Checkout Latency Incident (INC-1183)
│ ▪ slack War room thread: checkout 5xx spike
│ ▪ jira INC-1183 — Elevated 5xx on checkout API
│ … 3 more documents
│
├──◆ linked-document 0.60 → 2 ───────────────────────────────────────────
│ Postmortem: Checkout Latency Incident (INC-1183)
│ ↓ shares: incident, checkout
│ Customer QBR — Northwind Retail
│
●─ 2 what are the risks going into the Northwind renewal?
│ Tue 18 Aug 2026, 22:05 · 2 turns · 3 sources
│
│ ▪ gdrive Customer QBR — Northwind Retail
│ ▪ jira SUP-882 — Northwind: search results missing Confluence…
│ ▪ slack Northwind attachment issue — need connector eyes
│
──────────────────────────────────────────────────────────────────────────────
Documents a thread kept returning to lead the list; the rest hold the order they were cited in. Connections are ordered by how much they tell you — a linked-document link found something, while a shared-citation link between two runs of the same question is trivially certain and says little — so the discovery is never buried under a wall of 1.00 scores.
Each document is tagged with its datasource in a consistent colour, so a source is recognisable before you read its name. A connection names the session it reaches (→ 2), stacks the two documents that bridge around a ↓, and prints the shared evidence — shares: incident, checkout — so every link can be read rather than taken on trust. Colour is decoration only: piped, redirected, or under NO_COLOR, the glyphs still carry the structure.
status prints a table; timeline reports the file written; purge confirms before deleting.
Capture is opt-in for live data. The flow_capture config key defaults to mock, so real tenant content is never recorded until you set it to on. A local database has no permission model — see the retention section before enabling it against a tenant.
Mock mode — the built-in corpus is what this feature was tuned against: seven identifier clusters plus a QBR that references an incident in prose with no ticket number, which is the link worth finding.
Endpoint — (local — ~/.gleancode/flow.db; enrich calls /getdocuments or /summarize)
Translate a natural-language request into a sequence of Glean Code slash commands using Glean Assistant as the planner. Read docs/NATURAL_LANGUAGE.md for the full design.
/ask "<natural-language-request>"
?<natural-language-request>
The ? prefix is shorthand. Both forms are identical — ?login into acme-be.glean.com is the same as /ask "login into acme-be.glean.com".
| Parameter | Description |
|---|---|
<request> |
Plain English describing what you want to do. Multi-step requests work — "do X, then Y, and finish with Z". |
/ask "login into acme-be.glean.com with the stored token"
?login into acme-be.glean.com, then search for "Q2 plan"
?show me datasource health and start a chat
?rotate my indexing token and show its status
How it works — The CLI sends your request to /chat with a system prompt asking Glean to emit a JSON array of {cmd, args} steps. The reply is parsed locally, validated against the registered command set, rendered as a numbered plan, and (if any step is destructive) gated behind a single Run all? [y/N] confirm. Reads run automatically. Mock mode emits a canned plan without calling Glean.
Output — A numbered plan with [confirm] or [unknown — will be skipped] markers, then the output of each executed step.
Endpoint — POST /chat against your Glean instance. Full architecture in docs/NATURAL_LANGUAGE.md.
Show commands entered during the current session.
/history [--limit <n>]
| Parameter | Description |
|---|---|
--limit |
Maximum number of entries to show. Default 20. |
/history
/history --limit 5
Output — A numbered list of recent commands, newest last.
Endpoint — (local)
Clear the terminal screen.
/clear
/clear
Endpoint — (local)
Quit Glean Code.
/exit
/exit
Endpoint — (local)
Send a message to the Glean Assistant. Continues the current thread by default; use --new to start a fresh conversation.
/chat <message> [--new] [--chat-id <id>] [--agent <name>] [--stream]
| Parameter | Description |
|---|---|
message |
The user message. Quote it if it contains spaces. |
--new |
Start a new chat thread, discarding the current thread id. |
--chat-id |
Continue a specific chat thread by id. |
--agent |
Route the turn through a named agent configuration. |
--stream |
Request a streaming response. |
/chat "what did engineering ship last week?"
/chat "summarise the Q2 plan" --new
/chat "draft an email to Alice" --agent sales
Output — The assistant's response in a styled box, with cited source documents listed below. The active chat thread id is saved for subsequent /chat calls.
Mock mode — Citations are ranked against the mock corpus, so every cited document is one /docs.get and /summarize can fetch.
Endpoint — POST /rest/api/v1/chat
Search the Glean index and display ranked results with snippets.
/search <query> [--page-size <n>] [--datasource <name>]
| Parameter | Description |
|---|---|
query |
Free-text search query. |
--page-size |
Number of results to return. Defaults to default_page_size in config. |
--datasource |
Restrict results to one datasource, e.g. gdrive, slack, jira, confluence. |
/search "quarterly planning"
/search "oncall runbook" --datasource confluence --page-size 5
Output — Numbered result list, each showing title, datasource, URL, a byline (author, document type, container, freshness) when the API returns metadata, and a matching text snippet.
Mock mode — Results are ranked against the mock corpus: query terms score against title, tags, body, and container, --datasource genuinely filters (gdrive, confluence, jira, github, slack), and snippets come from the sentence that best matches the query. A query that matches nothing is padded with the freshest documents rather than returning empty. Page size is capped at 10.
Endpoint — POST /rest/api/v1/search
List all datasources visible to the current token, derived from a faceted search call.
/datasources.list [--with-counts] [--with-status] [--sample <n>]
| Parameter | Description |
|---|---|
--with-counts |
Show document counts per datasource. |
--with-status |
Fetch full indexing status per datasource (requires indexing_token). |
--sample |
Sample size for the underlying search call. Default 100. |
/datasources.list
/datasources.list --with-counts
/datasources.list --with-status
/datasources.list --with-counts --sample 200
Output — A list of datasource names. With --with-counts: document counts alongside each name. With --with-status: uploaded/indexed counts and coverage % from the Indexing API.
Mock mode — Returns the five faux datasources with plausible index counts: gdrive 1840, confluence 920, slack 611, jira 430, github 268. See Mock Corpus.
Endpoint — POST /rest/api/v1/search (facets) + POST /api/index/v1/debug/{ds}/status
Get query suggestions for a partial search string.
/autocomplete <partial>
| Parameter | Description |
|---|---|
partial |
The in-progress query string. |
/autocomplete "quart"
/autocomplete "onboard"
Output — A list of suggested completions ranked by relevance.
Mock mode — Completions are built from the tags of documents matching what you typed, e.g. /autocomplete "quart" → quart planning, quart tracker, quart capacity.
Endpoint — POST /rest/api/v1/autocomplete
Get document recommendations for a user based on their activity and context.
/recommendations [--user <email>]
| Parameter | Description |
|---|---|
--user |
Target user email. Defaults to the authenticated user. |
/recommendations
/recommendations --user alice@acme.com
Output — A list of recommended document titles and URLs.
Mock mode — The five freshest mock corpus documents, in full search-result shape.
Endpoint — POST /rest/api/v1/recommendations
Send explicit feedback on a search result or chat turn using its tracking token.
/feedback <tracking-token> <rating> [--comment <text>]
| Parameter | Description |
|---|---|
tracking-token |
The trackingToken field returned in a search result or chat response. |
rating |
THUMBS_UP or THUMBS_DOWN. |
--comment |
Optional free-text comment. |
/feedback tok_1 THUMBS_UP
/feedback tok_1 THUMBS_DOWN --comment "wrong datasource"
Output — Confirmation that feedback was recorded.
Endpoint — POST /rest/api/v1/feedback
Show full indexing status for a single datasource: visibility, document upload and index counts, coverage percentage, and the last five processing events.
Requires indexing_token — set it with /config set indexing_token <token>.
/datasources.status <datasource>
| Parameter | Description |
|---|---|
datasource |
Datasource name, e.g. slack, gdrive, confluence. |
/datasources.status slack
/datasources.status gdrive
Output — Datasource visibility, uploaded document count, indexed document count, coverage %, and a table of the last 5 processing history events with timestamps.
Endpoint — POST /api/index/v1/debug/{datasource}/status
Rotate the indexing API token secret and print the new raw secret. Store it immediately — the old secret is invalidated.
/indexing.rotate-token
/indexing.rotate-token
Output — The new raw secret and a reminder to run /config set indexing_token <new-secret>.
Endpoint — POST /api/index/v1/rotatetoken
Get the live configuration for a custom datasource — object definitions, ACL settings, trusted domains, icon URL.
/datasources.config <datasource>
/datasources.config gdrive
/datasources.config custom1
Output — Datasource config object (object types, isUserReferencedByEmail, trustedDomains, datasourceCategory, etc.).
Endpoint — POST /api/index/v1/getdatasourceconfig
Get upload + indexing status for a single document.
/documents.status --datasource <ds> --object-type <type> --id <doc-id>
/documents.status --datasource gdrive --object-type Article --id doc-1
Output — uploadStatus, lastUploadedAt, lastIndexedAt, any indexing errors.
Endpoint — POST /api/index/v1/getdocumentstatus
Count uploaded documents in a custom datasource.
/documents.count --datasource <ds>
/documents.count --datasource custom1
Output — Document count.
Endpoint — POST /api/index/v1/getdocumentcount
Count users uploaded for a custom datasource.
/users.count --datasource <ds>
/users.count --datasource custom1
Output — User count.
Endpoint — POST /api/index/v1/getusercount
Check whether a specific user has access to a specific document — useful for debugging "why can't user X see doc Y?"
/documents.access --datasource <ds> --object-type <type> --id <doc> --user <email>
/documents.access --datasource gdrive --object-type Article --id doc-1 --user alice@example.com
Output — YES / NO access decision.
Endpoint — POST /api/index/v1/checkdocumentaccess
Get debug info (status + uploaded permissions) for a single document.
/debug.document <datasource> <doc-id> [--object-type <type>]
/debug.document gdrive doc-1 --object-type Article
Output — Document upload status, last-uploaded/indexed timestamps, ACL permissions.
Endpoint — POST /api/index/v1/debug/{datasource}/document
Bulk debug for multiple documents in a datasource.
/debug.documents <datasource> --from-file <items.json>
The JSON file should be an array of {objectType, docId} entries.
/debug.documents gdrive --from-file ./batch.json
Output — Per-document debug results.
Endpoint — POST /api/index/v1/debug/{datasource}/documents
Get debug info for a user in a datasource — upload status + uploaded group memberships.
/debug.user <datasource> <email>
/debug.user gdrive alice@example.com
Output — User upload status and groups uploaded via the permissions API.
Endpoint — POST /api/index/v1/debug/{datasource}/user
Index a single document. Supports two input modes — pass a fully-formed JSON body, or point at a local file and let the CLI synthesize the body for you.
/index.document (--from-file <doc.json> | --path <file>) \
[--datasource <ds>] [--object-type <type>] \
[--public | --acl-from-file <perms.json>] \
[--id-prefix <s>] [--view-url-prefix <url>] \
[--version <n>] [--dry-run]
| Flag | Description |
|---|---|
--from-file |
JSON file containing a full DocumentDefinition body |
--path |
Local file path. Synthesizes a DocumentDefinition from the file. Errors if a directory is passed — use /index.bulk-documents --path for folders |
--datasource |
(with --path) Datasource name |
--object-type |
(with --path) Object type (e.g. Article) |
--public |
(with --path) Make the doc world-readable. Mutually exclusive with --acl-from-file |
--acl-from-file |
(with --path) JSON file containing a DocumentPermissionsDefinition applied to the doc |
--id-prefix |
(with --path) String prepended to the path-derived id slug |
--view-url-prefix |
(with --path) Base URL prepended to the relative path. Defaults to file://<absolute> |
--version |
Optional version int for optimistic concurrency |
--dry-run |
Print the assembled request body and exit without calling the API |
Supported file types when using --path: .txt, .md, .markdown, .html, .htm, .json. Binary formats (PDF, .docx) are out of scope.
/index.document --from-file ./doc.json
/index.document --path ./README.md --datasource custom1 --object-type Article --public
/index.document --path ./team/onboarding.md --datasource custom1 --object-type Article \
--acl-from-file ./perms.json --dry-run
Output — Acceptance status from the API. With --dry-run, the assembled JSON body.
Endpoint — POST /api/index/v1/indexdocument
Delete a single document by id.
/index.delete-document --datasource <ds> --object-type <type> --id <doc-id> [--version <n>]
/index.delete-document --datasource gdrive --object-type Article --id doc-1
Output — Acceptance status.
Endpoint — POST /api/index/v1/deletedocument
Update document permissions (ACL).
/index.permissions --from-file <perms.json>
/index.permissions --from-file ./perms.json
Output — Acceptance status.
Endpoint — POST /api/index/v1/updatepermissions
Index a single user record.
/index.user --datasource <ds> --from-file <user.json> [--version <n>]
/index.user --datasource custom1 --from-file ./user.json
Output — Acceptance status.
Endpoint — POST /api/index/v1/indexuser
Delete a user from a datasource.
/index.delete-user --datasource <ds> --email <email> [--version <n>]
/index.delete-user --datasource custom1 --email alice@example.com
Output — Acceptance status.
Endpoint — POST /api/index/v1/deleteuser
Index a single group.
/index.group --datasource <ds> --from-file <group.json> [--version <n>]
/index.group --datasource custom1 --from-file ./group.json
Output — Acceptance status.
Endpoint — POST /api/index/v1/indexgroup
Delete a group from a datasource.
/index.delete-group --datasource <ds> --name <group-name> [--version <n>]
/index.delete-group --datasource custom1 --name engineering
Output — Acceptance status.
Endpoint — POST /api/index/v1/deletegroup
Index a single group membership.
/index.membership --datasource <ds> --from-file <membership.json> [--version <n>]
/index.membership --datasource custom1 --from-file ./membership.json
Output — Acceptance status.
Endpoint — POST /api/index/v1/indexmembership
Delete a single group membership.
/index.delete-membership --datasource <ds> --from-file <membership.json> [--version <n>]
/index.delete-membership --datasource custom1 --from-file ./membership.json
Output — Acceptance status.
Endpoint — POST /api/index/v1/deletemembership
Index a batch of documents (paged).
/index.documents --from-file <body.json>
The JSON file should contain the full IndexDocumentsRequest body (uploadId, datasource, documents).
Output — Upload id and accepted count.
Endpoint — POST /api/index/v1/indexdocuments
Bulk index documents — pass a hand-built JSON body (with uploadId, isFirstPage, isLastPage, etc.) or point at a local file/folder and let the CLI walk and assemble the request for you.
/index.bulk-documents (--from-file <body.json> | --path <file-or-dir>) \
[--datasource <ds>] [--object-type <type>] \
[--public | --acl-from-file <perms.json>] \
[--include <globs>] [--exclude <globs>] [--max-bytes <n>] \
[--id-prefix <s>] [--view-url-prefix <url>] \
[--upload-id <id>] [--dry-run]
| Flag | Description |
|---|---|
--from-file |
JSON file containing a BulkIndexDocumentsRequest body |
--path |
Local file or directory. Recursively walks directories |
--datasource |
(with --path) Datasource name |
--object-type |
(with --path) Object type applied to every walked file |
--public |
(with --path) Make all docs world-readable. Mutually exclusive with --acl-from-file |
--acl-from-file |
(with --path) JSON file with a DocumentPermissionsDefinition applied to every doc |
--include |
(with --path) Comma-separated globs to include. Default: *.txt,*.md,*.markdown,*.html,*.htm,*.json |
--exclude |
(with --path) Comma-separated globs to exclude. Default skips .git, node_modules, __pycache__, .DS_Store |
--max-bytes |
(with --path) Skip files larger than this many bytes. Default 5242880 (5 MB) |
--id-prefix |
(with --path) Prefix added to each path-derived id slug |
--view-url-prefix |
(with --path) Base URL prepended to each relative path. Defaults to file:// per file |
--upload-id |
(with --path) Override the auto-generated upload id |
--dry-run |
Print the assembled request body and exit without calling the API |
Heads-up: large directories produce large payloads. The CLI warns when more than 500 documents are matched. v1 sends them in one POST; auto-paging across
isFirstPage/isLastPageis planned for v2.
/index.bulk-documents --from-file ./bulk.json
/index.bulk-documents --path ./docs/ --datasource custom1 --object-type Article --public
/index.bulk-documents --path ./content/ --datasource custom1 --object-type Article \
--public --include "*.md,*.txt" --exclude "**/draft/**" --dry-run
Output — Upload acknowledgement (or, with --dry-run, the assembled body).
Endpoint — POST /api/index/v1/bulkindexdocuments
Bulk index users in pages.
/index.bulk-users --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexusers
Bulk index groups in pages.
/index.bulk-groups --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexgroups
Bulk index group memberships in pages.
/index.bulk-memberships --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexmemberships
Bulk index shortcuts via the Indexing API (distinct from the Client API /shortcuts.* commands which target end-user Go Links).
/shortcuts.bulk-index --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexshortcuts
Upload shortcuts via the Indexing API.
/shortcuts.upload --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/uploadshortcuts
Trigger processing of all uploaded documents — long-running.
/index.process-all-documents [--datasource <ds>]
/index.process-all-documents
/index.process-all-documents --datasource custom1
Output — Process status.
Endpoint — POST /api/index/v1/processalldocuments
Trigger processing of all uploaded group memberships.
/index.process-all-memberships [--datasource <ds>]
Output — Process status.
Endpoint — POST /api/index/v1/processallmemberships
Bulk index employee records (org chart side).
/people.bulk-employees --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexemployees
Bulk index team records (org chart side).
/people.bulk-teams --from-file <body.json>
Output — Upload acknowledgement.
Endpoint — POST /api/index/v1/bulkindexteams
Index a list of employees with optional per-employee versions.
/people.index-employee-list --from-file <list.json>
The JSON file may be a plain array of employee objects or {"employees": [...]}.
Output — Accepted employee count.
Endpoint — POST /api/index/v1/indexemployeelist
Trigger processing of all uploaded employees and teams.
/people.process-all-employees-teams
Output — Process status.
Endpoint — POST /api/index/v1/processallemployeesandteams
List agents available to the authenticated user.
/agents.list [--query <text>]
| Parameter | Description |
|---|---|
--query |
Filter agents by name or description. |
/agents.list
/agents.list --query sales
Output — A table of agent ids, names, and descriptions.
Endpoint — POST /rest/api/v1/agents/search
Run an agent by id and wait for its final output.
/agents.run <agent-id> <input> [--stream]
| Parameter | Description |
|---|---|
agent-id |
The agent id from /agents.list. |
input |
Free-text task description or prompt for the agent. |
--stream |
Use the streaming endpoint instead of waiting for the full response. |
/agents.run agt_research "write a market brief on AI in banking"
/agents.run agt_sales "summarise account Acme Corp" --stream
Output — The agent's final response in a styled box.
Endpoint — POST /rest/api/v1/agents/runs/wait (or /stream)
List callable tools exposed to agents in the current workspace.
/tools.list
/tools.list
Output — Tool names and descriptions.
Endpoint — POST /rest/api/v1/tools/list
Invoke a tool directly with a JSON argument object.
/tools.call <name> <json-args>
| Parameter | Description |
|---|---|
name |
Tool name from /tools.list. |
json-args |
JSON object of arguments. Wrap in single quotes to preserve double quotes. |
/tools.call search '{"query":"pto policy"}'
/tools.call create_doc '{"title":"Draft","body":"Hello world"}'
Output — The tool's raw result object printed as formatted JSON.
Endpoint — POST /rest/api/v1/tools/call
Fetch one or more documents by Glean document id or URL.
/docs.get [--id <id>]... [--url <url>]...
| Parameter | Description |
|---|---|
--id |
Glean document id. Repeatable. |
--url |
Document URL. Repeatable. |
/docs.get --id doc_123 --id doc_456
/docs.get --url https://docs.acme.com/plan
Output — Document metadata and content for each requested id or URL.
Mock mode — Ids and URLs resolve against the mock corpus — pass a URL straight from /search and you get the same title, author, and datasource back. An id or URL that isn't in the corpus is echoed back with a placeholder title.
Endpoint — POST /rest/api/v1/getdocuments
Fetch the permission list for a document.
/docs.permissions <doc-id>
| Parameter | Description |
|---|---|
doc-id |
Glean document id. |
/docs.permissions doc_123
Output — A list of email addresses and their roles (e.g. owner, viewer).
Mock mode — The document's author comes back as owner and the rest of the people roster as viewer, e.g. /docs.permissions doc_plan_process → priya.raman@acme.com as owner.
Endpoint — POST /rest/api/v1/getdocumentpermissions
List entities such as people, teams, or groups from the Glean directory.
/entities.list [--kind PEOPLE|TEAM|GROUP] [--page-size <n>] [--query <text>]
| Parameter | Description |
|---|---|
--kind |
Entity type. Default PEOPLE. |
--page-size |
Number of results. Defaults to default_page_size in config. |
--query |
Optional filter string matched against name. |
/entities.list
/entities.list --kind TEAM
/entities.list --kind PEOPLE --query alice
Output — A list of entity names, emails, and titles.
Mock mode — Returns the eight-person Acme roster with name, email, title, and department.
Endpoint — POST /rest/api/v1/listentities
Look up a person's full profile by email address.
/people.get <email>
| Parameter | Description |
|---|---|
email |
The person's email address. |
/people.get alice@acme.com
Output — Name, email, title, department, and any other profile fields returned by the API.
Mock mode — Looks the email up in the people roster, e.g. /people.get priya.raman@acme.com → Director of Engineering, Platform. An unknown email still returns a profile shape.
Endpoint — POST /rest/api/v1/people
List all current announcements in the workspace.
/announcements.list
/announcements.list
Output — Announcement ids, titles, and metadata.
Endpoint — POST /rest/api/v1/announcements/list
Create a new workspace announcement.
/announcements.create --title <text> --body <text> [--audience <filter>]
| Parameter | Description |
|---|---|
--title |
Headline for the announcement. |
--body |
Main body text. |
--audience |
Optional audience filter string to target a subset of users. |
/announcements.create --title "All hands Friday" --body "10am PT, Zoom link in calendar"
/announcements.create --title "System maintenance" --body "Sunday 2am–4am PT" --audience engineering
Output — The new announcement id and creation status.
Endpoint — POST /rest/api/v1/announcements/create
Delete an announcement by id.
/announcements.delete <id>
| Parameter | Description |
|---|---|
id |
The announcement id (from /announcements.list). |
/announcements.delete ann_123
Output — Confirms the announcement was deleted.
Endpoint — POST /rest/api/v1/announcements/delete
List all collections in the workspace.
/collections.list
/collections.list
Output — Collection ids, names, and descriptions.
Mock mode — Three collections named after the mock corpus clusters: Quarterly Planning, On-Call and Incidents, New Engineer Onboarding.
Endpoint — POST /rest/api/v1/listcollections
Create a new collection for grouping related documents.
/collections.create --name <text> [--description <text>]
| Parameter | Description |
|---|---|
--name |
Collection name. |
--description |
Optional description. |
/collections.create --name Onboarding
/collections.create --name Onboarding --description "New hire docs and links"
Output — The new collection id and name.
Endpoint — POST /rest/api/v1/createcollection
List all pinned results in the workspace.
/pins.list
/pins.list
Output — Pin ids, queries they are attached to, and target URLs.
Endpoint — POST /rest/api/v1/listpins
Pin a URL to a search query so it appears as the top result for that query.
/pins.create --query <text> --url <url>
| Parameter | Description |
|---|---|
--query |
The search query to attach the pin to. |
--url |
The URL to surface as the pinned result. |
/pins.create --query pto --url https://hr.acme.com/pto
/pins.create --query "expense policy" --url https://wiki.acme.com/expenses
Output — The new pin id and creation status.
Endpoint — POST /rest/api/v1/createpin
Remove a pinned result by id.
/pins.delete <id>
| Parameter | Description |
|---|---|
id |
Pin id from /pins.list. |
/pins.delete pin_1
Output — Confirms the pin was removed.
Endpoint — POST /rest/api/v1/unpin
Delete one or more collections by id.
/collections.delete <id> [<id>...]
| Parameter | Description |
|---|---|
id |
Collection id(s) from /collections.list. Repeatable. |
/collections.delete 1
/collections.delete 1 2 3
Output — Confirms the collection(s) were deleted.
Endpoint — POST /rest/api/v1/deletecollection
List Go Links (shortcuts) owned by the current user.
/shortcuts.list [--query <text>] [--page-size <n>]
| Parameter | Description |
|---|---|
--query |
Filter shortcuts by alias or description. |
--page-size |
Number of results. Default 20. |
/shortcuts.list
/shortcuts.list --query eng
Output — Table of shortcut ids, go/<alias>, destination URLs, and descriptions.
Endpoint — POST /rest/api/v1/listshortcuts
Look up a single Go Link by alias.
/shortcuts.get <alias>
| Parameter | Description |
|---|---|
alias |
The shortcut alias, e.g. pto. |
/shortcuts.get pto
/shortcuts.get oncall
Output — Id, alias, destination URL, and description.
Endpoint — POST /rest/api/v1/getshortcut
Create a new Go Link.
/shortcuts.create --alias <alias> --url <url> [--description <text>] [--unlisted]
| Parameter | Description |
|---|---|
--alias |
Short alias for the link, e.g. pto. |
--url |
Destination URL. |
--description |
Optional description shown in search. |
--unlisted |
Hide from public listing. |
/shortcuts.create --alias pto --url https://hr.acme.com/pto
/shortcuts.create --alias oncall --url https://wiki.acme.com/oncall --description "On-call runbook"
Output — Confirms creation with the new shortcut id.
Endpoint — POST /rest/api/v1/createshortcut
Update an existing Go Link's alias, URL, or description.
/shortcuts.update <id> [--alias <alias>] [--url <url>] [--description <text>]
| Parameter | Description |
|---|---|
id |
Shortcut id from /shortcuts.list. |
--alias |
New alias. |
--url |
New destination URL. |
--description |
New description. |
/shortcuts.update 1 --url https://hr.acme.com/new-pto
/shortcuts.update 1 --alias vacay --description "Updated vacation policy"
Output — Confirms the update.
Endpoint — POST /rest/api/v1/updateshortcut
Delete a Go Link by id.
/shortcuts.delete <id>
| Parameter | Description |
|---|---|
id |
Shortcut id from /shortcuts.list. |
/shortcuts.delete 1
Output — Confirms deletion.
Endpoint — POST /rest/api/v1/deleteshortcut
List Q&A answers created by the current user.
/answers.list
/answers.list
Output — Each answer's id, question, and body text.
Endpoint — POST /rest/api/v1/listanswers
Fetch the full details of a single answer by id.
/answers.get <id>
| Parameter | Description |
|---|---|
id |
Answer id from /answers.list. |
/answers.get 1
Output — Question and answer body in a styled box.
Endpoint — POST /rest/api/v1/getanswer
Create a new Q&A answer in the knowledge base.
/answers.create --question <text> --body <text> [--audience <filter>]
| Parameter | Description |
|---|---|
--question |
The question text. |
--body |
The answer body text. |
--audience |
Optional audience filter string. |
/answers.create --question "What is our PTO policy?" --body "20 days per year."
Output — Confirms creation with the new answer id.
Endpoint — POST /rest/api/v1/createanswer
Edit an existing answer's question or body.
/answers.update <id> [--question <text>] [--body <text>]
| Parameter | Description |
|---|---|
id |
Answer id from /answers.list. |
--question |
Updated question text. |
--body |
Updated answer body text. |
/answers.update 1 --body "25 days per year effective Jan 1."
Output — Confirms the update.
Endpoint — POST /rest/api/v1/editanswer
Delete an answer by id.
/answers.delete <id>
| Parameter | Description |
|---|---|
id |
Answer id from /answers.list. |
/answers.delete 1
Output — Confirms deletion.
Endpoint — POST /rest/api/v1/deleteanswer
Ask Glean AI to summarize a document by URL or id. Optionally focus the summary with a question.
/summarize [--url <url>] [--id <doc-id>] [--query <focus>]
| Parameter | Description |
|---|---|
--url |
Document URL to summarize. |
--id |
Glean document id to summarize. |
--query |
Optional focus question to guide the summary. |
/summarize --url https://docs.acme.com/q2-plan
/summarize --id doc_123 --query "What are the key risks?"
Output — AI-generated summary in a styled box.
Mock mode — A URL or id from the mock corpus summarizes to that document's own opening lines, owner, and freshness. Anything else falls back to a generic summary that echoes what you passed.
Endpoint — POST /rest/api/v1/summarize
List documents pending or due for verification.
/verification.list [--count <n>]
| Parameter | Description |
|---|---|
--count |
Max number of items to return. Default 20. |
/verification.list
/verification.list --count 50
Output — Table of documents with their verification status (VERIFIED / UNVERIFIED), title, id, and last verified timestamp.
Mock mode — The six freshest mock corpus documents, alternating UNVERIFIED and VERIFIED, so the queue has both states to act on.
Endpoint — POST /rest/api/v1/listverifications
Mark a document as verified or unverify it.
/verification.verify <doc-id> [--action VERIFY|UNVERIFY]
| Parameter | Description |
|---|---|
doc-id |
Glean document id. |
--action |
VERIFY (default) or UNVERIFY. |
/verification.verify doc_123
/verification.verify doc_123 --action UNVERIFY
Output — Confirms the new verification status.
Endpoint — POST /rest/api/v1/verify
Set a verification reminder for a document, optionally assigning it to someone.
/verification.remind <doc-id> [--days <n>] [--assignee <email>] [--reason <text>]
| Parameter | Description |
|---|---|
doc-id |
Glean document id. |
--days |
Remind in this many days. Default 30. |
--assignee |
Email of the person to assign the reminder to. |
--reason |
Optional reason for the reminder. |
/verification.remind doc_123
/verification.remind doc_123 --days 7 --assignee alice@acme.com --reason "Quarterly review"
Output — Confirms the reminder was set.
Endpoint — POST /rest/api/v1/addverificationreminder
Retrieve a message thread from a connected datasource such as Slack or Microsoft Teams.
/messages.get --id <id> --datasource <name> [--id-type <type>] [--direction BEFORE|AFTER]
| Parameter | Description |
|---|---|
--id |
Message id. |
--datasource |
Datasource name, e.g. slack, msteams. |
--id-type |
Id type. Default MESSAGE_ID. |
--direction |
BEFORE or AFTER — fetch surrounding thread context. |
/messages.get --id 1234567890.123456 --datasource slack
/messages.get --id 1234567890.123456 --datasource slack --direction AFTER
Output — Author and text for each message in the thread.
Mock mode — Returns the corpus's three Slack threads (#planning, #incident-checkout, #sales-eng) with channel, author, and timestamp. See the faux datasources.
Endpoint — POST /rest/api/v1/messages
Report a document view or edit event. Helps Glean improve search ranking and recommendations.
/activity.report --url <url> [--action VIEW|EDIT]
| Parameter | Description |
|---|---|
--url |
URL of the document the activity occurred on. |
--action |
Activity type: VIEW (default) or EDIT. |
/activity.report --url https://docs.acme.com/plan
/activity.report --url https://docs.acme.com/plan --action EDIT
Output — Confirms the number of events processed.
Endpoint — POST /rest/api/v1/activity
The Custom Metadata API lets you attach independent structured metadata to any document already indexed in Glean — across native connectors, custom datasources, anything — without re-uploading the document. These commands hit https://<host>/rest/api/index and reuse the indexing_token configured via /config set indexing_token. The token must be scoped with custommetadata:<group_name> or custommetadata:global_scope.
Create or update the schema for a metadata group. The schema declares which keys are allowed and what type each one holds (TEXT, PICKLIST, TEXTLIST, or MULTIPICKLIST).
/metadata.set-schema --group <name> (--from-file <schema.json> | --keys name:TYPE[,name2:TYPE2]) [--dry-run]
| Parameter | Description |
|---|---|
--group |
Metadata group name (alphanumeric). |
--from-file |
JSON file: a list of metadata-key dicts or {"metadataKeys": [...]}. |
--keys |
Inline keys: comma-separated name:TYPE[:skip] entries. |
--dry-run |
Print the assembled body and exit. |
/metadata.set-schema --group hr --keys department:PICKLIST,region:TEXT
/metadata.set-schema --group hr --from-file ./hr-schema.json
Endpoint — PUT /rest/api/index/custom-metadata/schema/{groupName}
Fetch the current schema for a metadata group.
/metadata.get-schema --group <name>
Endpoint — GET /rest/api/index/custom-metadata/schema/{groupName}
Delete a group's schema.
/metadata.delete-schema --group <name>
Endpoint — DELETE /rest/api/index/custom-metadata/schema/{groupName}
Attach (or replace) custom metadata on an indexed document. Note: this is a PUT — it replaces the full set of metadata for the (docId, group) pair, so include every key you want preserved.
/metadata.attach --doc-id <id> --group <name> (--from-file <pairs.json> | --values name=value[,name=value]) [--dry-run]
| Parameter | Description |
|---|---|
--doc-id |
Glean document id (from /docs.get or search). |
--group |
Metadata group name. |
--from-file |
JSON file: a list of {name, value} entries or {"customMetadata": [...]}. Required for TEXTLIST/MULTIPICKLIST array values. |
--values |
Inline string values: name=value,name2=value2. TEXT/PICKLIST only. |
--dry-run |
Print the assembled body and exit. |
/metadata.attach --doc-id ABC --group hr --values department=Engineering,region=US
/metadata.attach --doc-id ABC --group hr --from-file ./pairs.json
Endpoint — PUT /rest/api/index/document/{docId}/custom-metadata/{groupName}
Remove all custom metadata for a (document, group) pair.
/metadata.detach --doc-id <id> --group <name>
Endpoint — DELETE /rest/api/index/document/{docId}/custom-metadata/{groupName}
Generate a self-contained Python starter project for a Glean API surface. Credentials are read from ~/.gleancode/config.json so the generated file works immediately. Generated files are stdlib-only.
/scaffold <chat|search|agent> [--output <dir>]
| Parameter | Description |
|---|---|
template |
Which template to generate: chat, search, or agent. |
--output |
Output directory. Prompted interactively if omitted. You will be asked to confirm before a new directory is created. |
/scaffold chat
/scaffold search --output ~/projects/glean-search
/scaffold agent --output ./my-agent-app
| Template | What it generates |
|---|---|
chat |
Interactive chat loop with single-turn CLI mode |
search |
Search script with --datasource and --page-size flags |
agent |
Lists available agents and runs one by id |
Output — Writes a single .py file to the output directory and prints the full path.
Endpoint — (local, writes a standalone .py file)