MCPcopy Create free account
hub / github.com/1jehuang/jcode / format_tokens

Function format_tokens

scripts/jcode_monitor.py:110–119  ·  view source on GitHub ↗

Format token count with color based on size

(n: int)

Source from the content-addressed store, hash-verified

108
109
110def format_tokens(n: int) -> str:
111 """Format token count with color based on size"""
112 if n == 0:
113 return f"{Colors.DIM}0{Colors.RESET}"
114 elif n < 1000:
115 return f"{Colors.GREEN}{n}{Colors.RESET}"
116 elif n < 10000:
117 return f"{Colors.YELLOW}{n:,}{Colors.RESET}"
118 else:
119 return f"{Colors.RED}{n:,}{Colors.RESET}"
120
121
122def format_tool(name: str, status: str = "active") -> str:

Callers 1

render_dashboardFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected