Skip to main content
Claude Code has two web tools: WebFetch for retrieving and analyzing specific URLs, and WebSearch for querying the web when information may be beyond Claude’s training cutoff.

WebFetch

Fetches a URL, converts the HTML to markdown, and then processes the content using a small fast model with a prompt you provide. Returns the model’s response — not the raw page content.

Parameters

url
string
required
A fully-formed, valid URL. HTTP URLs are automatically upgraded to HTTPS.
prompt
string
required
A natural-language prompt describing what to extract or analyze from the page content. The fetched content is passed to a secondary model along with this prompt, and the model’s response is returned.

Behavior

  1. Claude fetches the URL and converts HTML to markdown.
  2. The markdown and the prompt are sent to a small, fast model.
  3. That model’s response is returned as the tool result.
Because a secondary model processes the content, the result is always a synthesized answer — not a raw dump of the page. If the content is very large, it may be summarized automatically.
WebFetch includes a 15-minute in-memory cache. Repeated calls to the same URL within that window return cached content without a network request.

Redirects

When a URL redirects to a different host, the tool returns a special message indicating the redirect destination rather than following it automatically. Claude then makes a new WebFetch call with the redirect URL.

Limitations

  • Read-only — does not submit forms or interact with pages
  • Not suitable for pages requiring authentication (login walls, paywalls)
  • For GitHub resources, prefer the gh CLI via Bash (e.g., gh pr view, gh issue view, gh api)
If an MCP-provided web fetch tool is available in your environment, it may have fewer restrictions and should be preferred over this built-in tool.

Example usage

{
  "url": "https://docs.example.com/api/authentication",
  "prompt": "What authentication methods are supported and what headers are required?"
}

WebSearch

Searches the web and returns results including titles, URLs, and a model-synthesized summary. Useful when information may be newer than Claude’s training data.
Web search is only available in the United States. It requires a compatible API provider (Anthropic first-party, Vertex AI with Claude 4.0+ models, or Foundry).

Parameters

query
string
required
The search query to execute. Minimum length: 2 characters.
allowed_domains
string[]
When set, only return results from these domains. Cannot be combined with blocked_domains in the same request.Example: ["docs.python.org", "peps.python.org"]
blocked_domains
string[]
Exclude results from these domains. Cannot be combined with allowed_domains in the same request.Example: ["w3schools.com"]

Output

The tool returns search results as structured blocks containing:
  • Result titles and URLs
  • A synthesized summary produced by a model that has access to the search results
Claude is required to cite sources from web searches by appending a Sources: section with markdown hyperlinks to its response.

Domain filtering

Use allowed_domains when you want results exclusively from trusted or authoritative sources:
{
  "query": "Python asyncio best practices 2024",
  "allowed_domains": ["docs.python.org", "realpython.com"]
}
Use blocked_domains to suppress low-quality or paywalled sources:
{
  "query": "React server components tutorial",
  "blocked_domains": ["medium.com"]
}

Search limits

Each WebSearch invocation performs up to 8 individual web searches internally. Claude automatically refines queries as needed within that budget.

Current date awareness

When searching for recent information, Claude includes the current year in search queries to avoid returning outdated results — for example, appending the year when searching for library documentation or current events.