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

Function validateInput

source code/tools/SkillTool/SkillTool.ts:356–432  ·  view source on GitHub ↗
({ skill }, context)

Source from the content-addressed store, hash-verified

354 toAutoClassifierInput: ({ skill }) => skill ?? '',
355
356 async validateInput({ skill }, context): Promise<ValidationResult> {
357 // Skills are just skill names, no arguments
358 const trimmed = skill.trim()
359 if (!trimmed) {
360 return {
361 result: false,
362 message: `Invalid skill format: ${skill}`,
363 errorCode: 1,
364 }
365 }
366
367 // Remove leading slash if present (for compatibility)
368 const hasLeadingSlash = trimmed.startsWith('/')
369 if (hasLeadingSlash) {
370 logEvent('tengu_skill_tool_slash_prefix', {})
371 }
372 const normalizedCommandName = hasLeadingSlash
373 ? trimmed.substring(1)
374 : trimmed
375
376 // Remote canonical skill handling (ant-only experimental). Intercept
377 // `_canonical_<slug>` names before local command lookup since remote
378 // skills are not in the local command registry.
379 if (
380 feature('EXPERIMENTAL_SKILL_SEARCH') &&
381 process.env.USER_TYPE === 'ant'
382 ) {
383 const slug = remoteSkillModules!.stripCanonicalPrefix(
384 normalizedCommandName,
385 )
386 if (slug !== null) {
387 const meta = remoteSkillModules!.getDiscoveredRemoteSkill(slug)
388 if (!meta) {
389 return {
390 result: false,
391 message: `Remote skill ${slug} was not discovered in this session. Use DiscoverSkills to find remote skills first.`,
392 errorCode: 6,
393 }
394 }
395 // Discovered remote skill — valid. Loading happens in call().
396 return { result: true }
397 }
398 }
399
400 // Get available commands (including MCP skills)
401 const commands = await getAllCommands(context)
402
403 // Check if command exists
404 const foundCommand = findCommand(normalizedCommandName, commands)
405 if (!foundCommand) {
406 return {
407 result: false,
408 message: `Unknown skill: ${normalizedCommandName}`,
409 errorCode: 2,
410 }
411 }
412
413 // Check if command has model invocation disabled

Callers

nothing calls this directly

Calls 3

logEventFunction · 0.85
findCommandFunction · 0.85
getAllCommandsFunction · 0.70

Tested by

no test coverage detected