Add native web-search tool to all three LLM adapters

↗ view on GitHub · Claude · 2026-05-31 · 0ad1b344

Enable each provider's built-in, server-executed web search so the main
chat can browse the internet:
- Claude: native web_search_20250305 server tool
- OpenAI Responses: web_search built-in tool
- Gemini: googleSearch grounding tool

These run server-side (the provider performs the search and folds
results into its answer), so they bypass the runTools function-call
loop. A new enableWebSearch flag on StreamChatParams gates them; only
the interactive main chat (runLLMStream) opts in, leaving tabular
review and bulk extraction untouched.

Surface searches to the UI via a new onWebSearch callback that each
adapter fires when a search starts - Claude on the server_tool_use
contentBlock, OpenAI on the web_search_call output item, Gemini on
groundingMetadata.webSearchQueries. runLLMStream streams a web_search
event and persists it to the assistant message (unlike the transient
tool_call_start), so reloaded chats still show "Searched the web for
...". Added the web_search variant to the backend and frontend
AssistantEvent unions, a stream handler, and a WebSearchBlock renderer.

Backend and frontend typecheck clean.
Repository mwcyu/Mike-fork
Author Claude <noreply@anthropic.com>
Authored
Parents 9dfb6fd5
Stats 8 files changed , +153 , -8
Part of Native provider web-search in the main chat

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-0ad1b344.md from inside the repo you want the change in.

⬇ Download capture-commit-0ad1b344.md