WebFetch for fetching a specific URL and WebSearch for discovering information across the web.
WebFetch
Fetches content from a URL and processes it with an AI model to extract the information you need. HTML is converted to Markdown before processing.Parameters
The fully-formed URL to fetch. HTTP URLs are automatically upgraded to HTTPS. Must be a valid URL — an invalid URL will produce an error without making a network request.
Instructions describing what information to extract from the fetched page. The content is processed by a small, fast model using this prompt, and the model’s response is returned.Example:
"What are the required parameters for the createUser endpoint?"Output
The processed response from the model, based on the fetched content and the prompt.
The URL that was fetched.
HTTP response status code.
HTTP response status text (e.g.,
"OK", "Not Found").Size of the fetched content in bytes.
Time taken to fetch and process the content in milliseconds.
Usage notes
- Authenticated URLs will fail. WebFetch cannot access Google Docs, Confluence, Jira, GitHub private repos, or any URL requiring a login. Use a specialized MCP tool if you need authenticated access.
- If an MCP server provides a web fetch tool, prefer it — it may have fewer restrictions.
- For GitHub URLs, prefer using the
ghCLI via theBashtool (e.g.,gh pr view,gh issue view). - HTTP redirects to the same host are followed automatically. Redirects to a different host are surfaced in the
resultfield with the redirect URL. Make a newWebFetchcall with the redirect URL to continue. - Results may be summarized when content is very large.
- A 15-minute cache is maintained for repeated fetches of the same URL.
- Binary content (PDFs, etc.) is saved to a temporary file and the path is noted in
result.
Permissions
WebFetch requires permission before fetching from a domain. Claude Code will prompt you on the first request to a new domain. You can permanently allow a domain in your settings.Examples
Fetch API documentation
Extract a code example
Check library version requirements
WebSearch
Searches the web and returns results with summaries and source links. Uses Anthropic’s web search capability, which performs searches automatically within a single API call.WebSearch is only available when using Anthropic’s API directly (first-party), Vertex AI with Claude 4.0+ models, or Foundry. It is not available with all API configurations.
Parameters
The search query. Minimum 2 characters. Be specific — include the current year when searching for recent information, documentation, or news.
When provided, only include search results from these domains. Cannot be used together with
blocked_domains.Example: ["docs.python.org", "pypi.org"]When provided, exclude search results from these domains. Cannot be used together with
allowed_domains.Example: ["stackoverflow.com"]Output
The search query that was executed.
An array of search result objects and text commentary from the model. Each element is either:Or a plain string containing the model’s commentary or summary.
Time taken to complete the search operation.
Response format
Claude Code’s response to aWebSearch call includes both the search results and a synthesized answer. Sources must be cited at the end of the response as markdown hyperlinks.
Example response format
Usage notes
- WebSearch is only available in the US.
- A single WebSearch call may internally perform up to 8 sub-searches.
- Domain filtering (
allowed_domainsandblocked_domains) is mutually exclusive — only provide one or the other. - Always include the current year in queries about recent releases, documentation versions, or current events.
Examples
Search for library documentation
Search within specific domains
Search excluding specific domains