MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / estimateTokens

Function estimateTokens

src/tools/context-tree.ts:26–28  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

24const CHARS_PER_TOKEN = 4;
25
26function estimateTokens(text: string): number {
27 return Math.ceil(text.length / CHARS_PER_TOKEN);
28}
29
30async function buildTree(entries: FileEntry[], _rootDir: string, includeSymbols: boolean): Promise<TreeNode> {
31 const root: TreeNode = { name: ".", relativePath: ".", isDirectory: true, children: [] };

Callers 1

getContextTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected