WebSearch Tool - Claude Code
Perform web searches and return ranked results with snippets.
WebSearch runs a search query and returns ranked results with titles, URLs, and snippets. It's the first step when Claude needs to find something on the open web.
What it does
You pass a query and WebSearch returns a list of results - similar to what you'd see on a search engine page - trimmed to what's useful for follow-up work. Claude typically pairs it with WebFetch: search, pick the best link, fetch, read. Results include a mix of docs, articles, and issue threads depending on the query.
When to use it
- Finding the current version of an API or library.
- Looking up recent news, outages, or announcements.
- Discovering a doc URL you don't have on hand.
- Comparing multiple sources before committing to an answer.
Gotchas
- Snippets are short. Always WebFetch the top result if you need real content.
- Results can be region-biased depending on the backend.
- WebSearch is not as precise as a vendor-specific doc search. For library docs, prefer a dedicated source.
Official docs: https://code.claude.com/docs/en/tools-reference.md
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




