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

Method webSearchSummary

src/main/java/com/tcode/agent/Agent.java:629–640  ·  view source on GitHub ↗
(ToolExecutionResult result)

Source from the content-addressed store, hash-verified

627 }
628
629 private String webSearchSummary(ToolExecutionResult result) {
630 String text = result.result() == null ? "" : result.result();
631 if (text.startsWith("搜索失败") || text.startsWith("⚠️") || text.contains("未找到相关结果")) {
632 return compactOneLine(text, 120);
633 }
634 long count = text.lines().filter(line -> line.matches("^\\d+\\.\\s+.*")).count();
635 String query = extractJsonArg(result.argumentsJson(), "query");
636 String label = query.isBlank() ? "搜索结果" : "搜索 \"" + query + "\"";
637 return count > 0
638 ? label + " 返回 " + count + " 条结果"
639 : label + " 已返回结果";
640 }
641
642 private String webFetchSummary(ToolExecutionResult result) {
643 String text = result.result() == null ? "" : result.result();

Callers 1

emitToolResultSummaryMethod · 0.95

Calls 6

compactOneLineMethod · 0.95
extractJsonArgMethod · 0.95
resultMethod · 0.80
containsMethod · 0.80
countMethod · 0.80
matchesMethod · 0.45

Tested by

no test coverage detected