





















@@ -2,31 +2,72 @@
22summary: "CLI reference for `openclaw docs` (search the live docs index)"
33read_when:
44 - You want to search the live OpenClaw docs from the terminal
5+ - You need to know which helper binaries the docs CLI shells out to
56title: "Docs"
67---
7889# `openclaw docs`
91010-Search the live docs index.
11+Search the live OpenClaw docs index from the terminal. The command shells out to the public Mintlify-hosted docs MCP search endpoint at `https://docs.openclaw.ai/mcp.SearchOpenClaw` and renders the results in your terminal.
12+13+## Usage
14+15+```bash
16+openclaw docs # print docs entrypoint and example search
17+openclaw docs <query...> # search the live docs index
18+```
11191220Arguments:
132114-- `[query...]`: search terms to send to the live docs index
22+| Argument | Description |
23+| ------------ | ---------------------------------------------------------------------------------- |
24+| `[query...]` | Free-form search query. Multi-word queries are joined with spaces and sent as one. |
152516-Examples:
26+## Examples
17271828```bash
19-openclaw docs
2029openclaw docs browser existing-session
2130openclaw docs sandbox allowHostControl
2231openclaw docs gateway token secretref
2332```
243325-Notes:
34+With no query, `openclaw docs` prints the docs entrypoint URL plus a sample search command instead of running a search.
35+36+## How it works
37+38+`openclaw docs` invokes the `mcporter` CLI to call the docs search MCP tool, then parses the `Title: / Link: / Content:` blocks from the tool output into a list of results.
39+40+To resolve `mcporter`, OpenClaw checks in order:
41+42+1. `mcporter` on `PATH` (used directly if present).
43+2. `pnpm dlx mcporter ...` if `pnpm` is installed.
44+3. `npx -y mcporter ...` if `npx` is installed.
45+46+If none are available, the command fails with a hint to install `pnpm` (`npm install -g pnpm`).
47+48+The search call uses a fixed 30 second timeout. Result snippets are truncated to ~220 characters per entry.
49+50+## Output
51+52+In a rich (TTY) terminal, results render as a heading followed by a bullet list. Each bullet shows the page title, the linked docs URL, and a short snippet on the next line. Empty results print "No results.".
53+54+In non-rich output (piped, `--no-color`, scripts), the same data renders as Markdown:
55+56+```markdown
57+# Docs search: <query>
58+59+- [Title](https://docs.openclaw.ai/...) - snippet
60+- [Title](https://docs.openclaw.ai/...) - snippet
61+```
62+63+## Exit codes
266427-- With no query, `openclaw docs` opens the live docs search entrypoint.
28-- Multi-word queries are passed through as one search request.
65+| Code | Meaning |
66+| ---- | --------------------------------------------------- |
67+| `0` | Search succeeded (including zero-result responses). |
68+| `1` | The MCP tool call failed; stderr is printed inline. |
29693070## Related
31713272- [CLI reference](/cli)
73+- [Live docs](https://docs.openclaw.ai)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。