---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tools/searxng/functions/createSearxngSearchTool.md
---

# Function: createSearxngSearchTool()

```ts
function createSearxngSearchTool(config: SearxngToolConfig): Tool;
```

Defined in: [batteries/tools/searxng/index.ts:209](https://github.com/NHTIO/ADK/blob/v1.20260609.0/src/batteries/tools/searxng/index.ts#L209)

Create a configured SearXNG search [Tool](../../../../forge/classes/Tool.md).

## Parameters

| Parameter | Type                                                      | Description                                                                                                                                                                         |
| --------- | --------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config`  | [`SearxngToolConfig`](../interfaces/SearxngToolConfig.md) | The instance URL, optional custom headers, output-format policy, artifact type, and input/output middleware pipelines. See [SearxngToolConfig](../interfaces/SearxngToolConfig.md). |

## Returns

[`Tool`](../../../../forge/classes/Tool.md)

A `Tool` ready to register in a `ToolRegistry`.

## Remarks

The handler always requests `format=json`. Note that SearXNG ships with JSON output
**disabled** by default (it is abused by bots); an instance that has not enabled
`search.formats: [json]` in its `settings.yml` answers with HTTP 403, which the tool returns
as a graceful `Error:` string naming the setting.

##

::: warning
Do not trust the `number_of_results` field for a result count — SearXNG frequently reports `0`
in JSON output even when `results` is non-empty. This is a long-standing upstream quirk, not a
tool defect (see [searxng#2987](https://github.com/searxng/searxng/issues/2987) and
[searxng#2457](https://github.com/searxng/searxng/issues/2457)). The tool passes the
field through verbatim; use `results.length` as the authoritative count.
:::

## Throws

[E\_INVALID\_SEARXNG\_CONFIG](../../../variables/E_INVALID_SEARXNG_CONFIG.md) when `instanceUrl` is missing or unparseable.
