feat: add openclaw origin-name alias to MCP tool descriptions
Claude Code sees tools as mcp__openclaw__<name> but skills/instructions reference the original OpenClaw name (e.g. "memory_search"). Each tool description now includes a disambiguation line: [openclaw tool: <name>] If any skill or instruction refers to "<name>", this is the tool to call. This ensures Claude can correctly map skill references to the right tool even when the MCP prefix makes the name appear different. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -91,11 +91,17 @@ async function handleRequest(msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (method === "tools/list") {
|
if (method === "tools/list") {
|
||||||
const tools = toolDefs.map((t) => ({
|
const tools = toolDefs.map((t) => {
|
||||||
name: t.function.name,
|
const originName = t.function.name;
|
||||||
description: t.function.description ?? "",
|
const baseDesc = t.function.description ?? "";
|
||||||
inputSchema: t.function.parameters ?? { type: "object", properties: {} },
|
const aliasNote = `[openclaw tool: ${originName}] If any skill or instruction refers to "${originName}", this is the tool to call.`;
|
||||||
}));
|
const description = baseDesc ? `${baseDesc}\n${aliasNote}` : aliasNote;
|
||||||
|
return {
|
||||||
|
name: originName,
|
||||||
|
description,
|
||||||
|
inputSchema: t.function.parameters ?? { type: "object", properties: {} },
|
||||||
|
};
|
||||||
|
});
|
||||||
sendResult(id, { tools });
|
sendResult(id, { tools });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user