web_search
Search the web and X (Twitter) for real-time information, returning structured citations. Filter by date, domain, or specific X accounts to find current discussions and sources.
Instructions
Deep web + X (Twitter) search. Grok runs the retrieval; you read the sources.
In native mode this calls xAI's Responses API with the real web_search and
x_search tools, so citations come back as structured API data rather than
text the model wrote. X search is the reason to reach for this tool: live
community reaction, developer chatter, and breaking discussion that does not
exist in a search index yet.
Use x_handles to pin the search to specific accounts, and from_date/to_date
to bound it in time (both ISO8601, e.g. 2026-08-01).
Returns:
- session_id: string (pass to get_sources for the full source list)
- content: string (answer only)
- sources_count: int (0 means retrieval genuinely returned nothing -- treat
any factual claim in content as unverified)
- search_mode: "native" | "legacy" (which path actually served the request)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Override search mode for this call: 'native' (Responses API tools), 'legacy' (prompt-only chat/completions), or 'auto'. Empty uses GROK_SEARCH_MODE. | |
| model | No | Optional model ID for this request only. This value is used ONLY when user explicitly provided. | |
| query | Yes | Clear, self-contained natural-language search query. | |
| to_date | No | Latest date to consider, ISO8601 (e.g. 2026-08-23). | |
| platform | No | Target platform to focus on (e.g., 'Twitter', 'GitHub', 'Reddit'). Leave empty for general web search. | |
| from_date | No | Earliest date to consider, ISO8601 (e.g. 2026-08-01). Applies to both web and X search. | |
| x_handles | No | Comma-separated X handles to restrict the X search to (max 20), e.g. 'unity,unity3d'. Leading @ optional. | |
| extra_sources | No | Number of additional reference results from Tavily/Firecrawl. Set 0 to disable. Default 0. | |
| allowed_domains | No | Comma-separated domains to restrict web search to, e.g. 'docs.unity3d.com'. | |
| excluded_domains | No | Comma-separated domains to exclude from web search. | |
| exclude_x_handles | No | Comma-separated X handles to exclude from the X search (max 20). |