openclaw - 💡(How to fix) Fix [Bug]: External plugin tools register in metadata but are not surfaced to agent sessions [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59047Fetched 2026-04-08 02:29:26
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1renamed ×1

Tools registered via api.registerTool() in external (non-bundled) plugins appear in openclaw plugins inspect output but are never exposed to agent sessions via openclaw agent. Bundled plugin tools (e.g. memory_search from memory-core) work correctly.

There are two compounding issues when installing external plugins from a local folder via openclaw plugins install ./path:

  1. Plugin fails to load at all — the jiti alias resolver walks up from ~/.openclaw/extensions/<plugin>/ to find the OpenClaw package root, but never reaches /usr/lib/node_modules/openclaw. This causes Cannot find module 'openclaw/plugin-sdk/core'. Workaround: symlink the global openclaw package into the plugin's node_modules/.
  2. Tools don't surface to agents — even after the symlink workaround makes the plugin load successfully, and tools register into the plugin registry (confirmed via plugins inspect), they are not wired into the agent's callable tool surface. Only bundled plugin tools (Origin: bundled) appear in agent sessions.

Error Message

test-tool-plugin failed to load from ~/.openclaw/extensions/test-tool-plugin/index.ts: Error: Cannot find module 'openclaw/plugin-sdk/core'

Root Cause

  • Bundled plugin tools (e.g. memory_search from memory-core, Origin: bundled) work correctly
    • External plugin tools (Origin: global, installed from local folder) register but don't surface
    • Both static tool objects and factory functions (_ctx) => tool exhibit the same behavior
    • The plugin's register() function runs successfully (confirmed via logger output)
    • Updating from 2026.3.23-2 to 2026.3.24 did not fix the issue
    • Issue 1 (loading failure) is likely the same root cause as #53685 — buildPluginLoaderAliasMap doesn't pass argv1 through to resolveLoaderPluginSdkPackageRoot
    • Issue 2 (tools not surfacing) may be a separate bug in the agent tool resolver that only picks up tools from bundled plugins

Fix Action

Fix / Workaround

  1. Plugin fails to load at all — the jiti alias resolver walks up from ~/.openclaw/extensions/<plugin>/ to find the OpenClaw package root, but never reaches /usr/lib/node_modules/openclaw. This causes Cannot find module 'openclaw/plugin-sdk/core'. Workaround: symlink the global openclaw package into the plugin's node_modules/.
  2. Tools don't surface to agents — even after the symlink workaround makes the plugin load successfully, and tools register into the plugin registry (confirmed via plugins inspect), they are not wired into the agent's callable tool surface. Only bundled plugin tools (Origin: bundled) appear in agent sessions.

3. Apply symlink workaround to fix loading:

mkdir -p ~/.openclaw/extensions/test-tool-plugin/node_modules
ln -sf /usr/lib/node_modules/openclaw ~/.openclaw/extensions/test-tool-plugin/node_modules/openclaw
openclaw config set plugins.allow '["test-tool-plugin"]'
openclaw gateway restart

Code Example

// test-plugin/index.ts
  const plugin = {
    id: "test-tool-plugin",
    name: "Test Tool Plugin",
    description: "Minimal plugin to test tool registration",
    register(api: any) {
      api.registerTool(
        (_ctx: any) => ({
          name: "test_hello",
          description: "A simple test tool that returns a greeting",
          parameters: { type: "object", properties: {}, additionalProperties: false },
          async execute() {
            return { content: [{ type: "text", text: "Hello from test-tool-plugin!" }] };
          },
        }),
        { name: "test_hello" },
      );
      api.logger.info("[test-tool-plugin] Tool registered");
    },
  };
  export default plugin;

---

// test-plugin/package.json
  { "name": "test-tool-plugin", "version": "1.0.0", "type": "module",
    "openclaw": { "extensions": ["./index.ts"] } }

---

// test-plugin/openclaw.plugin.json
  { "id": "test-tool-plugin", "configSchema": { "type": "object", "additionalProperties": false, "properties": {} } }

---

openclaw plugins install ./test-plugin

---

test-tool-plugin failed to load from ~/.openclaw/extensions/test-tool-plugin/index.ts:
Error: Cannot find module 'openclaw/plugin-sdk/core'

---

mkdir -p ~/.openclaw/extensions/test-tool-plugin/node_modules
ln -sf /usr/lib/node_modules/openclaw ~/.openclaw/extensions/test-tool-plugin/node_modules/openclaw
openclaw config set plugins.allow '["test-tool-plugin"]'
openclaw gateway restart

---

$ openclaw plugins inspect test-tool-plugin
# Output includes:
# Status: loaded
# Tools:
# test_hello

---

$ openclaw agent --agent main --message "list all your tools"
# Output lists read, write, edit, exec, process, web_search, web_fetch,
# cron, sessions_*, memory_search, memory_get
# BUT NOT test_hello

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Tools registered via api.registerTool() in external (non-bundled) plugins appear in openclaw plugins inspect output but are never exposed to agent sessions via openclaw agent. Bundled plugin tools (e.g. memory_search from memory-core) work correctly.

There are two compounding issues when installing external plugins from a local folder via openclaw plugins install ./path:

  1. Plugin fails to load at all — the jiti alias resolver walks up from ~/.openclaw/extensions/<plugin>/ to find the OpenClaw package root, but never reaches /usr/lib/node_modules/openclaw. This causes Cannot find module 'openclaw/plugin-sdk/core'. Workaround: symlink the global openclaw package into the plugin's node_modules/.
  2. Tools don't surface to agents — even after the symlink workaround makes the plugin load successfully, and tools register into the plugin registry (confirmed via plugins inspect), they are not wired into the agent's callable tool surface. Only bundled plugin tools (Origin: bundled) appear in agent sessions.

Steps to reproduce

1. Create a minimal external plugin:

  // test-plugin/index.ts
  const plugin = {
    id: "test-tool-plugin",
    name: "Test Tool Plugin",
    description: "Minimal plugin to test tool registration",
    register(api: any) {
      api.registerTool(
        (_ctx: any) => ({
          name: "test_hello",
          description: "A simple test tool that returns a greeting",
          parameters: { type: "object", properties: {}, additionalProperties: false },
          async execute() {
            return { content: [{ type: "text", text: "Hello from test-tool-plugin!" }] };
          },
        }),
        { name: "test_hello" },
      );
      api.logger.info("[test-tool-plugin] Tool registered");
    },
  };
  export default plugin;
  // test-plugin/package.json
  { "name": "test-tool-plugin", "version": "1.0.0", "type": "module",
    "openclaw": { "extensions": ["./index.ts"] } }
  // test-plugin/openclaw.plugin.json
  { "id": "test-tool-plugin", "configSchema": { "type": "object", "additionalProperties": false, "properties": {} } }

2. Install from local folder:

openclaw plugins install ./test-plugin

This produces:

test-tool-plugin failed to load from ~/.openclaw/extensions/test-tool-plugin/index.ts:
Error: Cannot find module 'openclaw/plugin-sdk/core'

3. Apply symlink workaround to fix loading:

mkdir -p ~/.openclaw/extensions/test-tool-plugin/node_modules
ln -sf /usr/lib/node_modules/openclaw ~/.openclaw/extensions/test-tool-plugin/node_modules/openclaw
openclaw config set plugins.allow '["test-tool-plugin"]'
openclaw gateway restart

4. Verify plugin loads and tool is registered:

$ openclaw plugins inspect test-tool-plugin
# Output includes:
# Status: loaded
# Tools:
# test_hello

5. Check agent tool availability:

$ openclaw agent --agent main --message "list all your tools"
# Output lists read, write, edit, exec, process, web_search, web_fetch,
# cron, sessions_*, memory_search, memory_get
# BUT NOT test_hello

Logs confirm registration runs: [plugins] [test-tool-plugin] Tool registered

Expected behavior

test_hello should appear in the agent's callable tool list, just like memory_search does from the bundled memory-core plugin.

Actual behavior

Actual behavior

  • Without symlink: plugin fails to load entirely (Cannot find module 'openclaw/plugin-sdk/...')
  • With symlink: plugin loads, tool registers in metadata (visible via plugins inspect), but the tool is not wired into the agent's tool resolution surface. The agent cannot see or call it.

OpenClaw version

2026.3.28

Operating system

Linux (Ubuntu, x64)

Install method

curl -fsSL https://openclaw.ai/install.sh | bash

Model

GPT5.4

Provider / routing chain

codex token

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Key observations

  • Bundled plugin tools (e.g. memory_search from memory-core, Origin: bundled) work correctly
  • External plugin tools (Origin: global, installed from local folder) register but don't surface
  • Both static tool objects and factory functions (_ctx) => tool exhibit the same behavior
  • The plugin's register() function runs successfully (confirmed via logger output)
  • Updating from 2026.3.23-2 to 2026.3.24 did not fix the issue
  • Issue 1 (loading failure) is likely the same root cause as #53685 — buildPluginLoaderAliasMap doesn't pass argv1 through to resolveLoaderPluginSdkPackageRoot
  • Issue 2 (tools not surfacing) may be a separate bug in the agent tool resolver that only picks up tools from bundled plugins

Environment

  • OpenClaw 2026.3.24 (also 2026.3.23-2)
  • Node v22.22.0
  • Linux (Ubuntu, x64)
  • Plugin installed via openclaw plugins install ./local-path
  • Global install at /usr/lib/node_modules/openclaw

extent analysis

TL;DR

The issue can be addressed by modifying the plugin loading mechanism to correctly resolve the OpenClaw package root and updating the agent tool resolver to include tools from external plugins.

Guidance

  • Verify that the openclaw package is correctly symlinked in the plugin's node_modules directory to resolve the loading issue.
  • Investigate the buildPluginLoaderAliasMap function to ensure it correctly passes the argv1 through to resolveLoaderPluginSdkPackageRoot, potentially fixing Issue 1.
  • Review the agent tool resolver code to identify why it only picks up tools from bundled plugins and modify it to include tools from external plugins, addressing Issue 2.
  • Test the modifications with a minimal external plugin, such as the provided test-plugin, to confirm that tools are correctly registered and exposed to agent sessions.

Example

No code example is provided as the issue requires modifications to the OpenClaw core code, which is not included in the issue description.

Notes

The provided information suggests that there are two separate issues: one related to plugin loading and another related to tool registration. Addressing these issues may require modifications to the OpenClaw core code.

Recommendation

Apply a workaround by modifying the plugin loading mechanism and the agent tool resolver to correctly handle external plugins, as the root cause of the issue is likely related to these components.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

test_hello should appear in the agent's callable tool list, just like memory_search does from the bundled memory-core plugin.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING