MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / truncateOutput

Method truncateOutput

src/mcp/tools.ts:9006–9012  ·  view source on GitHub ↗

* Truncate output if it exceeds the maximum length

(text: string)

Source from the content-addressed store, hash-verified

9004 * Truncate output if it exceeds the maximum length
9005 */
9006 private truncateOutput(text: string): string {
9007 if (text.length <= MAX_OUTPUT_LENGTH) return text;
9008 const truncated = text.slice(0, MAX_OUTPUT_LENGTH);
9009 const lastNewline = truncated.lastIndexOf('\n');
9010 const cutPoint = lastNewline > MAX_OUTPUT_LENGTH * 0.8 ? lastNewline : MAX_OUTPUT_LENGTH;
9011 return truncated.slice(0, cutPoint) + '\n\n... (output truncated)';
9012 }
9013
9014 // =========================================================================
9015 // Formatting helpers (compact by default to reduce context usage)

Callers 7

handleSearchMethod · 0.95
handleCallersMethod · 0.95
handleCalleesMethod · 0.95
handleImpactMethod · 0.95
handleNodeMethod · 0.95
handleFileViewMethod · 0.95
handleFilesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected