MCPcopy Index your code
hub / github.com/codeaashu/claude-code / countSlashCommandTokens

Function countSlashCommandTokens

src/utils/analyzeContext.ts:521–552  ·  view source on GitHub ↗
(
  tools: Tools,
  getToolPermissionContext: () => Promise<ToolPermissionContext>,
  agentInfo: AgentDefinitionsResult | null,
)

Source from the content-addressed store, hash-verified

519}
520
521async function countSlashCommandTokens(
522 tools: Tools,
523 getToolPermissionContext: () => Promise<ToolPermissionContext>,
524 agentInfo: AgentDefinitionsResult | null,
525): Promise<{
526 slashCommandTokens: number
527 commandInfo: { totalCommands: number; includedCommands: number }
528}> {
529 const info = await getSlashCommandInfo(getCwd())
530
531 const slashCommandTool = findSkillTool(tools)
532 if (!slashCommandTool) {
533 return {
534 slashCommandTokens: 0,
535 commandInfo: { totalCommands: 0, includedCommands: 0 },
536 }
537 }
538
539 const slashCommandTokens = await countToolDefinitionTokens(
540 [slashCommandTool],
541 getToolPermissionContext,
542 agentInfo,
543 )
544
545 return {
546 slashCommandTokens,
547 commandInfo: {
548 totalCommands: info.totalCommands,
549 includedCommands: info.includedCommands,
550 },
551 }
552}
553
554async function countSkillTokens(
555 tools: Tools,

Callers 1

analyzeContextUsageFunction · 0.85

Calls 3

getCwdFunction · 0.85
findSkillToolFunction · 0.85

Tested by

no test coverage detected