MCPcopy Create free account
hub / github.com/Noumena-Network/code / countSlashCommandTokens

Function countSlashCommandTokens

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

Source from the content-addressed store, hash-verified

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

Callers 1

analyzeContextUsageFunction · 0.85

Calls 3

getCwdFunction · 0.85
findSkillToolFunction · 0.85

Tested by

no test coverage detected