--- title: "PreviewWebSearchServerTool" --- Web search preview tool configuration ## Fields | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `engine` | [Optional[components.WebSearchEngineEnum]](../components/websearchengineenum.mdx) | :heavy_minus_sign: | Which search engine to use. "auto" (default) uses native if the provider supports it, otherwise Exa. "native" forces the provider's built-in search. "exa" forces the Exa search API. "firecrawl" uses Firecrawl (requires BYOK). "parallel" uses the Parallel search API. "perplexity" uses the Perplexity Search API (raw ranked results). | auto | | `filters` | [OptionalNullable[components.WebSearchDomainFilter]](../components/websearchdomainfilter.mdx) | :heavy_minus_sign: | N/A | \{
"allowed_domains": [
"example.com"
],
"excluded_domains": [
"spam.com"
]
} | | `max_results` | *Optional[int]* | :heavy_minus_sign: | Maximum number of search results to return per search call. Defaults to 5. Applies to Exa, Firecrawl, Parallel, and Perplexity engines; ignored with native provider search. Perplexity supports a maximum of 20; values above 20 are clamped. | 5 | | `search_context_size` | [Optional[components.SearchContextSizeEnum]](../components/searchcontextsizeenum.mdx) | :heavy_minus_sign: | Size of the search context for web search tools | medium | | `type` | [components.PreviewWebSearchServerToolType](../components/previewwebsearchservertooltype.mdx) | :heavy_check_mark: | N/A | | | `user_location` | [OptionalNullable[components.PreviewWebSearchUserLocation]](../components/previewwebsearchuserlocation.mdx) | :heavy_minus_sign: | N/A | \{
"city": "San Francisco",
"country": "USA",
"region": "California",
"timezone": "America/Los_Angeles",
"type": "approximate"
} |