Skip to content

fix: pass tool names to registerTool factory opts#51

Open
Grynn wants to merge 1 commit intoMartian-Engineering:mainfrom
Grynn:fix/register-tool-names
Open

fix: pass tool names to registerTool factory opts#51
Grynn wants to merge 1 commit intoMartian-Engineering:mainfrom
Grynn:fix/register-tool-names

Conversation

@Grynn
Copy link
Contributor

@Grynn Grynn commented Mar 11, 2026

Problem

When lossless-claw loads on OpenClaw, the plugin status shows "status": "loaded" with no errors, but "toolNames": [] — the four LCM tools (lcm_grep, lcm_describe, lcm_expand, lcm_expand_query) are never exposed to the agent.

Root Cause

The tools are registered using factory functions without the opts.name hint:

api.registerTool((ctx) =>
  createLcmGrepTool({ deps, lcm, sessionKey: ctx.sessionKey }),
);

When a factory function is passed without opts.name/opts.names, OpenClaw cannot discover the tool names until the factory is invoked per-session, which prevents the tools from being injected into the agent's available tool list.

Fix

Pass { name: "..." } as the second argument to each registerTool call:

api.registerTool(
  (ctx) => createLcmGrepTool({ deps, lcm, sessionKey: ctx.sessionKey }),
  { name: "lcm_grep" },
);

Tool names match what each factory function returns (verified against src/tools/*.ts).

Fixes #32

When registering tools via factory functions, OpenClaw needs the
tool name hint in the opts parameter to discover tools before the
factory is invoked per-session. Without this, the plugin loads
successfully but toolNames remains empty ([]).

Fixes Martian-Engineering#32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tools (lcm_grep, lcm_describe, lcm_expand, lcm_expand_query) not exposed to agent runtime

1 participant