MCPcopy Create free account
hub / github.com/OperationT00/T-Code / compactOneLine

Method compactOneLine

src/main/java/com/tcode/agent/Agent.java:678–691  ·  view source on GitHub ↗
(String text, int maxLength)

Source from the content-addressed store, hash-verified

676 }
677
678 private String compactOneLine(String text, int maxLength) {
679 if (text == null || text.isBlank()) {
680 return "";
681 }
682 String value = text.replace("\r\n", "\n")
683 .replace('\r', '\n')
684 .lines()
685 .map(String::trim)
686 .filter(line -> !line.isEmpty())
687 .findFirst()
688 .orElse("")
689 .replaceAll("\\s+", " ");
690 return value.length() > maxLength ? value.substring(0, Math.max(0, maxLength - 3)) + "..." : value;
691 }
692
693 private void appendImageToolMessages(List<ToolExecutionResult> toolResults) {
694 if (toolResults == null || toolResults.isEmpty()) {

Callers 2

webSearchSummaryMethod · 0.95
webFetchSummaryMethod · 0.95

Calls 1

isEmptyMethod · 0.45

Tested by

no test coverage detected