* Gets all commands including MCP skills/prompts from AppState. * SkillTool needs this because getCommands() only returns local/bundled skills.
(context: ToolUseContext)
| 79 | * SkillTool needs this because getCommands() only returns local/bundled skills. |
| 80 | */ |
| 81 | async function getAllCommands(context: ToolUseContext): Promise<Command[]> { |
| 82 | // Only include MCP skills (loadedFrom === 'mcp'), not plain MCP prompts. |
| 83 | // Before this filter, the model could invoke MCP prompts via SkillTool |
| 84 | // if it guessed the mcp__server__prompt name — they weren't discoverable |
| 85 | // but were technically reachable. |
| 86 | const mcpSkills = context |
| 87 | .getAppState() |
| 88 | .mcp.commands.filter( |
| 89 | cmd => cmd.type === 'prompt' && cmd.loadedFrom === 'mcp', |
| 90 | ) |
| 91 | if (mcpSkills.length === 0) return getCommands(getProjectRoot()) |
| 92 | const localCommands = await getCommands(getProjectRoot()) |
| 93 | return uniqBy([...localCommands, ...mcpSkills], 'name') |
| 94 | } |
| 95 | |
| 96 | // Re-export Progress from centralized types to break import cycles |
| 97 | export type { SkillToolProgress as Progress } from '../../types/tools.js' |
no test coverage detected