MCPcopy Create free account
hub / github.com/Noumena-Network/code / truncateContent

Function truncateContent

src/utils/telemetry/betaSessionTracing.ts:104–118  ·  view source on GitHub ↗
(
  content: string,
  maxSize: number = MAX_CONTENT_SIZE,
)

Source from the content-addressed store, hash-verified

102 * Truncate content to fit within Honeycomb limits.
103 */
104export function truncateContent(
105 content: string,
106 maxSize: number = MAX_CONTENT_SIZE,
107): { content: string; truncated: boolean } {
108 if (content.length <= maxSize) {
109 return { content, truncated: false }
110 }
111
112 return {
113 content:
114 content.slice(0, maxSize) +
115 '\n\n[TRUNCATED - Content exceeds 60KB limit]',
116 truncated: true,
117 }
118}
119
120/**
121 * Generate a short hash (first 12 hex chars of SHA-256).

Callers 6

addToolContentEventFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected