MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / roughTokenCountEstimation

Function roughTokenCountEstimation

src/services/tokenEstimation.ts:215–220  ·  view source on GitHub ↗
(
  content: string,
  bytesPerToken: number = 4,
)

Source from the content-addressed store, hash-verified

213}
214
215export function roughTokenCountEstimation(
216 content: string,
217 bytesPerToken: number = 4,
218): number {
219 return Math.round(content.length / bytesPerToken)
220}
221
222/**
223 * Returns an estimated bytes-per-token ratio for a given file extension.

Callers 15

checkAgentDescriptionsFunction · 0.85
checkMcpToolsFunction · 0.85
getContentSizeEstimateFunction · 0.85
countBuiltInToolTokensFunction · 0.85
countMcpToolTokensFunction · 0.85
processAssistantMessageFunction · 0.85
processUserMessageFunction · 0.85
processAttachmentFunction · 0.85
logContextMetricsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected