MCPcopy
hub / github.com/CodebuffAI/codebuff / countTokensJson

Function countTokensJson

packages/agent-runtime/src/util/token-counter.ts:30–32  ·  view source on GitHub ↗
(text: string | object)

Source from the content-addressed store, hash-verified

28}
29
30export function countTokensJson(text: string | object): number {
31 return countTokens(JSON.stringify(text))
32}
33
34export function countTokensForFiles(
35 files: Record<string, string | null>,

Callers 8

runAgentStepFunction · 0.90
loopAgentStepsFunction · 0.90
find-files.tsFile · 0.90
pruneFileTokenScoresFunction · 0.90
getSearchSystemPromptFunction · 0.90

Calls 1

countTokensFunction · 0.85

Tested by

no test coverage detected