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

Function roughTokenCountEstimation

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

Source from the content-addressed store, hash-verified

201}
202
203export function roughTokenCountEstimation(
204 content: string,
205 bytesPerToken: number = 4,
206): number {
207 return Math.round(content.length / bytesPerToken)
208}
209
210/**
211 * 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