MCPcopy
hub / github.com/coder/mux / formatBytesSI

Function formatBytesSI

src/node/services/mcpResultTransform.ts:52–57  ·  view source on GitHub ↗

* Format byte size as human-readable string (KB or MB). * Uses decimal (SI) units (1000-based) — intentionally different from the shared * binary-unit formatBytes in @/common/utils/formatBytes which uses 1024-based thresholds.

(bytes: number)

Source from the content-addressed store, hash-verified

50 * binary-unit formatBytes in @/common/utils/formatBytes which uses 1024-based thresholds.
51 */
52function formatBytesSI(bytes: number): string {
53 if (bytes >= 1_000_000) {
54 return `${(bytes / 1_000_000).toFixed(1)} MB`;
55 }
56 return `${Math.round(bytes / 1000)} KB`;
57}
58
59/**
60 * Transform MCP tool result to AI SDK format.

Callers 1

transformMCPResultFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected