Skip to content

toolcraft: drop root group name from MCP tool prefix #276

@kamilio

Description

@kamilio

Problem

runMCP includes the root defineGroup name in every tool path. For:

const root = defineGroup({
  name: "todos-mcp",
  children: [defineGroup({ name: "slack",})],
});
runMCP(root, { name: "todos-mcp", version: "0.1.0" });

tools are exposed as todos_mcp__slack__fetch_messages. The MCP host already prepends its own mcp__<server>__, so the root name is redundant prefixing. Today the only workaround is name: "" on the root group, which also nukes the commander program name in CLI mode (program.name("")).

Source: packages/toolcraft/dist/mcp.js:

const rootPath = root.name.length === 0 ? [] : [root.name];

Proposal

Change enumerateTools to always start with rootPath = []. The root group's name stays a CLI concept (program name, help breadcrumb); MCP tool paths are built only from child groups and commands. Result above becomes slack__fetch_messages.

The MCP server name is already passed separately via runMCP(root, { name, version }), so nothing is lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions