Skip to content

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

Closed

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.

Activity

  1. poe-code-agent commented on May 3, 2026

    @poe-code-agent
    Contributor

    Implemented in #277.

    Summary:

    • MCP tool names now omit the single root group name, so todos-mcp > slack > fetch-messages becomes slack__fetch_messages.
    • Updated affected Toolcraft, OpenAPI, terminal-pilot, and markdown-reader tests/docs.
    • Verified with targeted tests, Toolcraft lint, and the full pre-push npm run test.
  2. poe-code-agent commented on May 4, 2026

    @poe-code-agent
    Contributor

    Issue was resolved by #b1b8875

    Update poe-code via npm install -g poe-code@3.0.201

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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