惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
G
Google Developers Blog
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
J
Java Code Geeks
P
Proofpoint News Feed
V
Visual Studio Blog
爱范儿
爱范儿
The Cloudflare Blog
博客园 - 叶小钗
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
M
MIT News - Artificial intelligence
Microsoft Security Blog
Microsoft Security Blog
博客园 - 聂微东
H
Help Net Security
B
Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
量子位
宝玉的分享
宝玉的分享
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat: add MCP code-mode namespace (#88636) · openclaw/ope...
steipete · 2026-05-31 · via Recent Commits to openclaw:main

@@ -44,6 +44,8 @@ When code mode is active:

4444

guest program through `ALL_TOOLS` and `tools`.

4545

- Guest code can search the hidden catalog, describe a tool, and call a tool

4646

through the same OpenClaw execution path used by normal agent turns.

47+

- MCP tools are grouped under the `MCP` namespace. In code mode, this namespace

48+

is the only supported way to call MCP tools.

4749

- `wait` resumes a suspended code-mode run when nested tool calls are still

4850

pending.

4951

@@ -381,6 +383,7 @@ The guest runtime exposes a small global API:

381383

```typescript

382384

declare const ALL_TOOLS: ToolCatalogEntry[];

383385

declare const tools: ToolCatalog;

386+

declare const MCP: Record<string, unknown>;

384387

declare const namespaces: Record<string, unknown>;

385388386389

declare function text(value: unknown): void;

@@ -432,6 +435,21 @@ const content = await tools.call(fileRead.id, { path: "README.md" });

432435

const hits = await tools.web_search({ query: "OpenClaw code mode" });

433436

```

434437438+

MCP catalog entries are not callable through `tools.call(...)` or convenience

439+

functions in code mode. Use the generated `MCP` namespace instead:

440+441+

```typescript

442+

const issue = await MCP.github.createIssue({

443+

owner: "openclaw",

444+

repo: "openclaw",

445+

title: "Investigate gateway logs",

446+

});

447+448+

const snapshot = await MCP.chromeDevtools.takeSnapshot({ output: "markdown" });

449+

const resource = await MCP.docs.resources.read("memo://one");

450+

const prompt = await MCP.docs.prompts.get("brief", { topic: "release" });

451+

```

452+435453

The guest runtime must not expose host objects directly. Inputs and outputs cross

436454

the bridge as JSON-compatible values with explicit size caps.

437455

@@ -613,10 +631,10 @@ Namespace changes should cover the security boundary and the guest behavior:

613631

- suspended namespace calls resume through `wait`

614632

- plugin rollback clears the owning namespace registrations

615633616-

Namespaces complement the generic `tools.search` / `tools.call` catalog. Use

617-

the catalog for arbitrary enabled tools; use namespaces for plugin-owned,

618-

documented domain APIs where concise code is more reliable than repeated schema

619-

lookups.

634+

Namespaces complement the generic `tools.search` / `tools.call` catalog. Use the

635+

catalog for arbitrary enabled OpenClaw, plugin, and client tools; use `MCP` for

636+

MCP tools; use other namespaces for plugin-owned, documented domain APIs where

637+

concise code is more reliable than repeated schema lookups.

620638621639

## Output API

622640

@@ -681,6 +699,12 @@ The catalog omits code-mode control tools:

681699682700

This prevents recursion and keeps the model-facing contract narrow.

683701702+

MCP entries stay in the run-scoped catalog so policy, approvals, hooks,

703+

telemetry, transcript projection, and exact tool ids remain shared with normal

704+

tool execution. The guest-facing `tools.call(...)` bridge rejects MCP entries;

705+

the generated `MCP.<server>.<tool>(...)` namespace resolves back to the exact

706+

catalog id and then dispatches through the same executor path.

707+684708

## Tool Search interaction

685709686710

Code mode supersedes the OpenClaw Tool Search model surface for runs where it is

@@ -693,6 +717,7 @@ When `tools.codeMode.enabled` is true and code mode activates:

693717

- The same cataloging idea moves inside the guest runtime.

694718

- The guest runtime receives compact `ALL_TOOLS` metadata and search, describe,

695719

and call helpers.

720+

- MCP calls use the generated `MCP` namespace instead of `tools.call(...)`.

696721

- Nested calls dispatch through the same OpenClaw executor path that Tool Search

697722

uses.

698723

@@ -912,6 +937,8 @@ Code mode coverage should prove:

912937

- all effective tools appear in `ALL_TOOLS`

913938

- denied tools do not appear in `ALL_TOOLS`

914939

- `tools.search`, `tools.describe`, and `tools.call` work for OpenClaw tools

940+

- MCP namespace calls work for visible MCP tools and direct MCP `tools.call`

941+

attempts fail closed

915942

- Tool Search control tools are hidden from both the model surface and the hidden

916943

catalog

917944

- nested calls preserve approval and hook behavior

@@ -939,13 +966,16 @@ Run these as integration or end-to-end tests when changing the runtime:

939966

5. Send an agent turn with OpenClaw, plugin, MCP, and client test tools.

940967

6. Assert the model-visible tool list is exactly `exec`, `wait`.

941968

7. In `exec`, read `ALL_TOOLS` and assert the effective test tools are present.

942-

8. In `exec`, call `tools.search`, `tools.describe`, and `tools.call`.

943-

9. Assert denied tools are absent and cannot be called by guessed id.

944-

10. Start a nested tool call that resolves after `exec` returns `waiting`.

945-

11. Call `wait` and assert the restored VM receives the tool result.

946-

12. Assert the final answer contains output produced after restore.

947-

13. Assert timeout, abort, and snapshot expiry clean up runtime state.

948-

14. Export trajectory and assert nested calls are visible under the parent

969+

8. In `exec`, call OpenClaw/plugin/client tools through `tools.search`,

970+

`tools.describe`, and `tools.call`.

971+

9. In `exec`, call MCP tools through `MCP.<server>.<tool>(...)` and assert direct

972+

MCP `tools.call(...)` attempts fail.

973+

10. Assert denied tools are absent and cannot be called by guessed id.

974+

11. Start a nested tool call that resolves after `exec` returns `waiting`.

975+

12. Call `wait` and assert the restored VM receives the tool result.

976+

13. Assert the final answer contains output produced after restore.

977+

14. Assert timeout, abort, and snapshot expiry clean up runtime state.

978+

15. Export trajectory and assert nested calls are visible under the parent

949979

code-mode call.

950980951981

Docs-only changes to this page should still run `pnpm check:docs`.