MCPcopy
hub / github.com/codeaashu/claude-code / getAllCommands

Function getAllCommands

src/tools/SkillTool/SkillTool.ts:81–94  ·  view source on GitHub ↗

* Gets all commands including MCP skills/prompts from AppState. * SkillTool needs this because getCommands() only returns local/bundled skills.

(context: ToolUseContext)

Source from the content-addressed store, hash-verified

79 * SkillTool needs this because getCommands() only returns local/bundled skills.
80 */
81async 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
97export type { SkillToolProgress as Progress } from '../../types/tools.js'

Callers 15

validateInputFunction · 0.70
checkPermissionsFunction · 0.70
callFunction · 0.70
checkDynamicCommandNameFunction · 0.50
checkEncodedCommandFunction · 0.50
checkPwshCommandOrFileFunction · 0.50
checkDownloadCradlesFunction · 0.50
checkDownloadUtilitiesFunction · 0.50
checkComObjectFunction · 0.50
checkForEachMemberNameFunction · 0.50
checkStartProcessFunction · 0.50

Calls 2

getCommandsFunction · 0.85
getProjectRootFunction · 0.85

Tested by

no test coverage detected