# WebSearchTools

Namespace: **Wisej.AI.Tools**

Assembly: **Wisej.AI** (3.5.0.0)

* [ToolsContainer](/ai/components/api/tools/wisej.ai.tools.toolscontainer.md)
  * [WebSearchTools](/ai/components/api/tools/wisej.ai.tools.websearchtools.md)

Represents a collection of tools for performing web searches and processing web content.

{% tabs %}
{% tab title="C#" %}

```csharp
public class WebSearchTools : ToolsContainer
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class WebSearchTools
    Inherits ToolsContainer
```

{% endtab %}
{% endtabs %}

This class provides functionality to search the web using a specified query and read content from specified URLs. It utilizes various services such as [IWebSearchService](/ai/components/api/services/iwebsearchservice.md), [ITokenizerService](/ai/components/api/services/itokenizerservice.md), [IHttpClientService](/ai/components/api/services/ihttpclientservice.md), and [IDocumentConversionService](/ai/components/api/services/idocumentconversionservice.md) to perform its operations.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) WebSearchTools()

Initializes a new instance of the [WebSearchTools](/ai/components/api/tools/wisej.ai.tools.websearchtools.md) class.

This constructor sets the [MaxSites](#maxsites) property of the [SearchService](#searchservice) if it is not null.

## Properties

### ![](/files/KL0Ik37djZRr8a07Wopd) DocumentConversionService

[IDocumentConversionService](/ai/components/api/services/idocumentconversionservice.md): Gets or sets the document conversion service used for converting web content.

### ![](/files/KL0Ik37djZRr8a07Wopd) HttpClientService

[IHttpClientService](/ai/components/api/services/ihttpclientservice.md): Gets or sets the HTTP client service used for making HTTP requests.

### ![](/files/ptrKjmmRoQB76pvrIqh0) MaxContextTokens

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum number of context tokens. (Default: `4096`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) MaxSites

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the maximum number of sites to search. (Default: `5`)

### ![](/files/KL0Ik37djZRr8a07Wopd) SearchService

[IWebSearchService](/ai/components/api/services/iwebsearchservice.md): Gets or sets the web search service used for searching the web.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Timeout

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Gets or sets the timeout in milliseconds. (Default: `30000`)

### ![](/files/KL0Ik37djZRr8a07Wopd) TokenizerService

[ITokenizerService](/ai/components/api/services/itokenizerservice.md): Gets or sets the tokenizer service used for truncating context tokens.

### ![](/files/ptrKjmmRoQB76pvrIqh0) UserAgent

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the User-Agent header. (Default: `"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"`)

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) DownloadAsync(urls)

Downloads content from the specified URLs asynchronously.

| Parameter | Type                                                              | Description                                |
| --------- | ----------------------------------------------------------------- | ------------------------------------------ |
| **urls**  | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of URLs to download content from. |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous download operation. The task result contains the downloaded content as a string.

### ![](/files/KL0Ik37djZRr8a07Wopd) read(urls)

Reads content from the specified URLs.

| Parameter | Type                                                              | Description                            |
| --------- | ----------------------------------------------------------------- | -------------------------------------- |
| **urls**  | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | An array of URLs to read content from. |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous read operation. The task result contains the content as a string.

### ![](/files/KL0Ik37djZRr8a07Wopd) search(query)

Searches the web using the specified query.

| Parameter | Type                                                          | Description       |
| --------- | ------------------------------------------------------------- | ----------------- |
| **query** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The search query. |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). A task that represents the asynchronous search operation. The task result contains the search result as a string.

## Implements

| Name                                                                          | Description                                                                                           |
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [IToolsContainer](/ai/components/api/tools/wisej.ai.tools.itoolscontainer.md) | Represents a container for tools, providing access to a hub, adapter, and a collection of parameters. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/tools/wisej.ai.tools.websearchtools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
