diff --git a/ghostcrew/interface/tui.py b/ghostcrew/interface/tui.py index 467dfb2..91f48ba 100644 --- a/ghostcrew/interface/tui.py +++ b/ghostcrew/interface/tui.py @@ -869,10 +869,9 @@ class GhostCrewTUI(App): def _add_tool_result(self, name: str, result: str) -> None: """Display tool execution result""" - # Truncate long results - if len(result) > 2000: - result = result[:2000] + "\n... (truncated)" - self._add_message(ToolResultMessage(name, result)) + # Hide tool output - LLM will synthesize it in its response + # This prevents duplication and keeps the chat clean + pass def _show_system_prompt(self) -> None: """Display the current system prompt""" diff --git a/ghostcrew/tools/web_search/__init__.py b/ghostcrew/tools/web_search/__init__.py index 6eadd10..af7a8d8 100644 --- a/ghostcrew/tools/web_search/__init__.py +++ b/ghostcrew/tools/web_search/__init__.py @@ -74,30 +74,28 @@ async def web_search(arguments: dict, runtime: "Runtime") -> str: def _format_results(query: str, data: dict) -> str: - """Format Tavily results for LLM consumption.""" + """ + Format Tavily results for LLM consumption. + + Returns a lean format with summary + titles + URLs only. + Content snippets are excluded to prevent LLM from regurgitating + noisy web scrapes in its response. + """ parts = [f"Search: {query}\n"] - # Include synthesized answer if available + # Include synthesized answer if available (this is the valuable part) if answer := data.get("answer"): parts.append(f"Summary:\n{answer}\n") - # Include individual results + # Include sources as title + URL only (no content snippets) results = data.get("results", []) if results: parts.append("Sources:") for i, result in enumerate(results, 1): title = result.get("title", "Untitled") url = result.get("url", "") - content = result.get("content", "") - - # Truncate content if too long - if len(content) > 500: - content = content[:500] + "..." - - parts.append(f"\n[{i}] {title}") - parts.append(f" URL: {url}") - if content: - parts.append(f" {content}") + parts.append(f" [{i}] {title}") + parts.append(f" {url}") else: parts.append("No results found")