Skip to main content
Claude has two tools for accessing web content: WebSearch for finding information via web search, and WebFetch for retrieving and processing the content of a specific URL.

WebSearch

Searches the web and returns results to inform Claude’s responses. Provides access to information beyond Claude’s knowledge cutoff, including current events and recent documentation. Searches are performed within a single API call. Results are returned as structured search result blocks containing titles, URLs, and content.
Web search is only available in the US. Responses must include a “Sources:” section listing relevant URLs from the search results.

Inputs

query
string
required
The search query. Minimum 2 characters. Claude uses the current month and year automatically to ensure searches for recent information return up-to-date results.
allowed_domains
string[]
When provided, search results are limited to these domains only. Useful for restricting results to trusted or authoritative sources.
blocked_domains
string[]
When provided, results from these domains are excluded.

Output

query
string
The search query that was executed.
results
array
Search results and any text commentary from the model. Each result contains:
  • title — title of the search result
  • url — URL of the search result
durationSeconds
number
Time taken to complete the search.

Permission requirements

WebSearch requires permission on first use. Because it accesses the external network, it is shown in the permission dialog before executing. You can approve it for the session or allow it permanently.

Source attribution

After answering using web search results, Claude is required to include a Sources: section listing the URLs used as markdown hyperlinks. This section is mandatory and must not be omitted.

Example

WebSearch:
  query: "React 19 release notes 2025"
  allowed_domains:
    - react.dev
    - github.com

WebFetch

Fetches the content of a specific URL, converts HTML to markdown, and processes it using a small AI model with a user-provided prompt. Returns the model’s response based on the page content. The tool includes a 15-minute self-cleaning cache. If the same URL is fetched again within the cache window, the cached content is used to avoid redundant network requests. HTTP URLs are automatically upgraded to HTTPS.
If an MCP-provided web fetch tool is available in your environment, Claude will prefer it over WebFetch, as it may have fewer restrictions.

Inputs

url
string
required
The URL to fetch. Must be a fully-formed valid URL (for example, https://example.com/docs).
prompt
string
required
Instructions for the model that processes the fetched content. Describe what information you want extracted or summarized from the page.

Output

result
string
The model’s response after processing the page content with the provided prompt.
bytes
number
Size of the fetched content in bytes.
code
number
HTTP response status code.
codeText
string
HTTP response status text (for example, "OK").
url
string
The URL that was fetched.
durationMs
number
Time taken to fetch and process the content in milliseconds.

Redirects

When a URL redirects to a different host, the tool returns a message indicating the redirect URL rather than following it automatically. Claude will make a new WebFetch request with the redirect URL to continue.

Permission requirements

WebFetch asks for permission grouped by hostname. Approving a fetch from docs.example.com applies to all subsequent fetches from that same host within the session. You can also permanently allow a hostname. Certain well-known domains (documentation sites and similar) are pre-approved and do not require a permission prompt.

GitHub URLs

For GitHub URLs, Claude prefers using the gh CLI via Bash (for example, gh pr view, gh issue view) rather than WebFetch, since the CLI provides structured data directly.

Example

WebFetch:
  url: "https://docs.anthropic.com/claude/docs"
  prompt: "Summarize the available API parameters for message creation"

Build docs developers (and LLMs) love