diff --git a/src/tools/slashcommand/slashcommand-tool.ts b/src/tools/slashcommand/slashcommand-tool.ts index f436c3ace..3de86a4a3 100644 --- a/src/tools/slashcommand/slashcommand-tool.ts +++ b/src/tools/slashcommand/slashcommand-tool.ts @@ -31,14 +31,13 @@ export function createSlashcommandTool(options: SlashcommandToolOptions = {}): T const buildDescription = async (): Promise => { if (cachedDescription) return cachedDescription - const allItems = await getAllItems() - cachedDescription = buildDescriptionFromItems(allItems) + const commands = getCommands() + cachedDescription = buildDescriptionFromItems(commands) return cachedDescription } - if (options.commands !== undefined && options.skills !== undefined) { - const allItems = [...options.commands, ...options.skills.map(skillToCommandInfo)] - cachedDescription = buildDescriptionFromItems(allItems) + if (options.commands !== undefined) { + cachedDescription = buildDescriptionFromItems(options.commands) } else { void buildDescription() } diff --git a/src/tools/slashcommand/tools.test.ts b/src/tools/slashcommand/tools.test.ts index f33c5ab07..aec487b58 100644 --- a/src/tools/slashcommand/tools.test.ts +++ b/src/tools/slashcommand/tools.test.ts @@ -29,7 +29,7 @@ function createMockSkill(name: string, description = ""): LoadedSkill { } describe("slashcommand tool - synchronous description", () => { - it("includes available_skills immediately when commands and skills are pre-provided", () => { + it("includes only commands in description, not skills", () => { // given const commands = [createMockCommand("commit", "Create a git commit")] const skills = [createMockSkill("playwright", "Browser automation via Playwright MCP")] @@ -38,12 +38,11 @@ describe("slashcommand tool - synchronous description", () => { const tool = createSlashcommandTool({ commands, skills }) // then - expect(tool.description).toContain("") expect(tool.description).toContain("commit") - expect(tool.description).toContain("playwright") + expect(tool.description).not.toContain("playwright") }) - it("includes all pre-provided commands and skills in description immediately", () => { + it("lists all commands but excludes skills from description", () => { // given const commands = [ createMockCommand("commit", "Git commit"), @@ -61,9 +60,9 @@ describe("slashcommand tool - synchronous description", () => { // then expect(tool.description).toContain("commit") expect(tool.description).toContain("plan") - expect(tool.description).toContain("playwright") - expect(tool.description).toContain("frontend-ui-ux") - expect(tool.description).toContain("git-master") + expect(tool.description).not.toContain("playwright") + expect(tool.description).not.toContain("frontend-ui-ux") + expect(tool.description).not.toContain("git-master") }) it("shows prefix-only description when both commands and skills are empty", () => {