> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/jackdog668/claude-code/llms.txt
> Use this file to discover all available pages before exploring further.

# Web tools

> Reference for the WebSearch and WebFetch tools that Claude uses to retrieve information from the web.

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.

<Note>
  Web search is only available in the US. Responses must include a "Sources:" section listing relevant URLs from the search results.
</Note>

### Inputs

<ParamField body="query" type="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.
</ParamField>

<ParamField body="allowed_domains" type="string[]">
  When provided, search results are limited to these domains only. Useful for restricting results to trusted or authoritative sources.
</ParamField>

<ParamField body="blocked_domains" type="string[]">
  When provided, results from these domains are excluded.
</ParamField>

### Output

<ResponseField name="query" type="string">
  The search query that was executed.
</ResponseField>

<ResponseField name="results" type="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
</ResponseField>

<ResponseField name="durationSeconds" type="number">
  Time taken to complete the search.
</ResponseField>

### 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

```text theme={null}
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.

<Note>
  If an MCP-provided web fetch tool is available in your environment, Claude will prefer it over `WebFetch`, as it may have fewer restrictions.
</Note>

### Inputs

<ParamField body="url" type="string" required>
  The URL to fetch. Must be a fully-formed valid URL (for example, `https://example.com/docs`).
</ParamField>

<ParamField body="prompt" type="string" required>
  Instructions for the model that processes the fetched content. Describe what information you want extracted or summarized from the page.
</ParamField>

### Output

<ResponseField name="result" type="string">
  The model's response after processing the page content with the provided prompt.
</ResponseField>

<ResponseField name="bytes" type="number">
  Size of the fetched content in bytes.
</ResponseField>

<ResponseField name="code" type="number">
  HTTP response status code.
</ResponseField>

<ResponseField name="codeText" type="string">
  HTTP response status text (for example, `"OK"`).
</ResponseField>

<ResponseField name="url" type="string">
  The URL that was fetched.
</ResponseField>

<ResponseField name="durationMs" type="number">
  Time taken to fetch and process the content in milliseconds.
</ResponseField>

### 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

```text theme={null}
WebFetch:
  url: "https://docs.anthropic.com/claude/docs"
  prompt: "Summarize the available API parameters for message creation"
```
