Description
When running a WebSearch tool call in the Web/Desktop UI, the summary chip on the tool execution card displays the total number of lines in the formatted output instead of the actual number of search results returned. For example, a search returning 8 items formatted across 94 text lines displays as 🔍 搜索 ... 94 结果 instead of 8 结果.
Steps to Reproduce
- In a chat session (Web/Desktop UI), trigger a
WebSearch tool call (e.g. searching Hono web framework 2026 features).
- The search backend returns 8 search results.
- Observe the tool header chip in the transcript card.
Observed Behavior
The chip displays 94 结果 (or 94 results), reflecting the total count of text lines in the formatted output.
Expected Behavior
The chip should display the actual number of returned search results (e.g. 8 结果 / 8 results).
Root Cause Analysis
In the Web UI's tool chip renderer (dist-web):
case "grep":
case "search":
return t.output && t.output.length > 0
? e("tools.chip.results", { count: t.output.length })
: "";
Here, t.output is an array of strings representing the output lines split by \n. Because WebSearchTool in packages/agent-core-v2 formats each search result as a multi-line block (Title, Site, Date, URL, Snippet, blank lines, and --- dividers), t.output.length equals the total line count (94 lines in this case) rather than the count of search result items.
Suggested Fix
- Provide structured metadata (e.g.,
result_count: number) on the tool result payload so the UI does not have to guess from line count; OR
- In the frontend chip renderer, count distinct items (e.g., counting
Title: occurrences or separator dividers) rather than raw t.output.length.
Description
When running a
WebSearchtool call in the Web/Desktop UI, the summary chip on the tool execution card displays the total number of lines in the formatted output instead of the actual number of search results returned. For example, a search returning 8 items formatted across 94 text lines displays as🔍 搜索 ... 94 结果instead of8 结果.Steps to Reproduce
WebSearchtool call (e.g. searchingHono web framework 2026 features).Observed Behavior
The chip displays
94 结果(or94 results), reflecting the total count of text lines in the formatted output.Expected Behavior
The chip should display the actual number of returned search results (e.g.
8 结果/8 results).Root Cause Analysis
In the Web UI's tool chip renderer (
dist-web):Here,
t.outputis an array of strings representing the output lines split by\n. BecauseWebSearchToolinpackages/agent-core-v2formats each search result as a multi-line block (Title,Site,Date,URL,Snippet, blank lines, and---dividers),t.output.lengthequals the total line count (94 lines in this case) rather than the count of search result items.Suggested Fix
result_count: number) on the tool result payload so the UI does not have to guess from line count; ORTitle:occurrences or separator dividers) rather than rawt.output.length.