Documentation Index
Fetch the complete documentation index at: https://chatjs.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Enable your AI to search the web in real-time and provide answers with inline citations. The tool supports multiple queries per request for comprehensive research.
Quick Start
Enable web search inchat.config.ts:
Environment Variables
Configure one of the supported search providers:If both keys are set, Tavily is used for regular chat and the provider can be
configured per-feature (e.g., deep research).
Providers
| Provider | Best For | Features |
|---|---|---|
| Tavily | General search | Topic filtering, news mode, domain exclusions |
| Firecrawl | Content extraction | High-quality markdown from web pages |
Tavily
Default provider with search-specific optimizations:- Topics:
generalornews(news limits to last 7 days) - Search depth:
basicoradvanced - Domain filtering: Exclude specific domains from results
Firecrawl
Alternative provider focused on content quality. Returns clean markdown extracted from pages.Features
Multi-Query Search
The tool accepts up to 2 queries per request, executed in parallel:Inline Citations
Search results are displayed as collapsible source cards. The AI is instructed to cite sources inline when using retrieved information.Progress Indicators
While searching, the UI shows:- Search status (running/completed)
- Query text being executed
- Number of sources found
Tool Output
Returns search results grouped by query:UI States
| State | Shows |
|---|---|
input-available | Progress indicator with query |
output-available | Collapsible source cards with titles and URLs |
Customization
Tool Definition
The tool is defined inlib/ai/tools/web-search.ts. You can modify:
- Maximum queries per request (
MAX_SEARCH_QUERIES) - Default results per query (
DEFAULT_MAX_RESULTS) - Tool description to adjust AI behavior
Provider Selection
To use Firecrawl instead of Tavily for regular chat, modifylib/ai/tools/tools.ts:
URL Retrieval
A separateretrieveUrl tool is available for fetching structured content from specific URLs (as opposed to searching the web). This tool uses Firecrawl to extract clean markdown from any webpage.
Enable in chat.config.ts:
- Page title and description
- Clean markdown content
- Source URL and language metadata