@@ -19,10 +19,11 @@ not depend on `tools.toolSearch`.
1919For the generic OpenClaw runtime that exposes a QuickJS-WASI ` exec ` /` wait `
2020surface instead of Tool Search controls, see [ Code Mode] ( /tools/code-mode ) .
2121
22- When enabled for OpenClaw runs, the model receives one ` tool_search_code ` tool
23- by default, plus any direct-only tools whose structured results cannot cross
24- the compact bridge. The code tool runs a short JavaScript body in an isolated
25- Node subprocess with an ` openclaw.tools ` bridge:
22+ When enabled for OpenClaw runs, the model automatically receives a bounded
23+ directory of the available trusted tool names and descriptions. By default, it
24+ also receives one ` tool_search_code ` tool, plus any direct-only tools whose
25+ structured results cannot cross the compact bridge. The code tool runs a short
26+ JavaScript body in an isolated Node subprocess with an ` openclaw.tools ` bridge:
2627
2728``` js
2829const hits = await openclaw .tools .search (" create a GitHub issue" );
@@ -34,10 +35,14 @@ return await openclaw.tools.call(tool.id, {
3435```
3536
3637The catalog can include catalog-eligible OpenClaw tools, plugin tools, MCP
37- tools, and client-provided tools. The model does not see every cataloged schema
38- up front. Instead, it searches compact descriptors, describes one selected
39- tool when it needs the exact schema, and calls that tool through OpenClaw.
40- Direct-only tools remain model-visible and are not added to the catalog.
38+ tools, and client-provided tools. The directory gives the model an idea of
39+ which trusted capabilities it can discover without exposing every cataloged
40+ schema up front. It also explains that policy-approved MCP and client tools
41+ may be discoverable. Their untrusted names and descriptions are not copied into
42+ the system prompt. Instead, the model searches compact descriptors, describes
43+ one selected tool when it needs the exact schema, and calls that tool through
44+ OpenClaw. Direct-only tools remain model-visible and are not added to the
45+ catalog.
4146
4247Codex harness runs do not receive these experimental OpenClaw Tool Search
4348controls. OpenClaw passes product capabilities to Codex as dynamic tools, and
55604 . Add eligible client tools supplied for the current run.
56615 . Keep direct-only tools model-visible and index compact descriptors for the
5762 remaining catalog-eligible tools.
58- 6 . Expose the OpenClaw code bridge, the structured fallback tools, or the
63+ 6 . Add a deterministic, bounded, policy-filtered capability directory to the
64+ cache-stable system-prompt prefix.
65+ 7 . Expose the OpenClaw code bridge, the structured fallback tools, or the
5966 compact directory surface alongside those direct-only tools.
6067
6168At execution time every real tool call returns to OpenClaw. The isolated Node
@@ -68,15 +75,14 @@ normal policy, approval, hook, logging, and result handling still apply.
6875` tools.toolSearch ` has three model-facing modes:
6976
7077- ` code ` : exposes ` tool_search_code ` , the default compact JavaScript bridge,
71- alongside direct-only tools.
78+ alongside the capability directory and direct-only tools.
7279- ` tools ` : exposes ` tool_search ` , ` tool_describe ` , and ` tool_call ` as plain
73- structured tools for providers that should not receive code, alongside
74- direct-only tools.
80+ structured tools for providers that should not receive code, alongside the
81+ capability directory and direct-only tools.
7582- ` directory ` : exposes ` tool_search ` , ` tool_describe ` , and ` tool_call ` plus a
76- bounded prompt directory of available tool names and descriptions for
77- providers that should see tool names without every full schema. OpenClaw can
78- also expose a small bounded set of likely or required tool schemas directly
79- for the current turn. Direct-only tools remain visible in this mode too.
83+ bounded prompt directory. Unlike the other modes, OpenClaw can also expose a
84+ small bounded set of likely or required tool schemas directly for the
85+ current turn. Direct-only tools remain visible in this mode too.
8086
8187All modes use the same policy-filtered catalog and normal OpenClaw execution
8288path. Tools marked ` catalogMode: "direct-only" ` stay outside that catalog and
@@ -103,10 +109,10 @@ selection.
103109Tool Search changes the shape:
104110
105111- direct tools: the model sees every selected schema before the first token
106- - Tool Search code mode: the model sees one compact code tool, a short API
107- contract, and any direct-only tools
112+ - Tool Search code mode: the model sees one compact code tool, a bounded
113+ capability directory, a short API contract, and any direct-only tools
108114- Tool Search tools mode: the model sees three compact structured fallback
109- tools plus any direct-only tools
115+ tools, the same capability directory, and any direct-only tools
110116- Tool Search directory mode: the model sees a bounded directory plus
111117 search/describe/call controls and a small bounded set of likely or required
112118 schemas, plus any direct-only tools
@@ -116,6 +122,15 @@ Direct tool exposure is still the right default for small catalogs. Tool Search
116122is best when one run can see many tools, especially from MCP servers or
117123client-provided app tools.
118124
125+ The capability directory is sorted by tool name, limited to 18,000 characters,
126+ and built from the already policy-filtered catalog. OpenClaw reuses the
127+ rendered directory for an unchanged catalog snapshot and places it above the
128+ system-prompt cache boundary. User messages, per-turn tool guesses, session
129+ identifiers, and untrusted MCP or client metadata do not enter the directory.
130+ This keeps repeated turns eligible for prompt KV-cache reuse. When the
131+ authorized catalog changes, OpenClaw builds a new directory for the new
132+ snapshot.
133+
119134## API
120135
121136` openclaw.tools.search(query, options?) `
0 commit comments