MCPcopy
hub / github.com/claude-code-best/claude-code / countSlashCommandTokens

Function countSlashCommandTokens

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

Source from the content-addressed store, hash-verified

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

Callers 1

analyzeContextUsageFunction · 0.85

Calls 3

getCwdFunction · 0.85
findSkillToolFunction · 0.85

Tested by

no test coverage detected