MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getAllCommands

Function getAllCommands

source code/tools/SkillTool/SkillTool.ts:83–96  ·  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

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