@nhtio/adk/batteries/tools/searxng
Factory for a configured SearXNG metasearch tool.
Remarks
Unlike the other bundled tool categories — every one of which exports a ready-made, stateless Tool constant — the SearXNG battery exports a factory, createSearxngSearchTool. A search tool has to talk to a specific SearXNG instance, usually behind custom authentication, so it needs per-deployment configuration (a base URL and headers) that cannot be baked in at module load.
Because this module exports a factory rather than a Tool instance, it MUST NOT be bulk-registered via Object.values(batteries). Call the factory first, then register the returned tool: new ToolRegistry([createSearxngSearchTool({ instanceUrl })]).
See
https://docs.searxng.org/dev/search_api.html
Interfaces
| Interface | Description |
|---|---|
| SearxngRequestContext | Mutable context handed to each input-pipeline stage before the HTTP request is sent. |
| SearxngResponseContext | Mutable context handed to each output-pipeline stage after the response JSON is parsed. |
| SearxngResult | A single normalised SearXNG result. SearXNG result items are deliberately untyped upstream, so every field except a best-effort title/url is optional. |
| SearxngToolConfig | Configuration for createSearxngSearchTool. |
Type Aliases
| Type Alias | Description |
|---|---|
| SearxngHeaders | A static set of request headers (used for custom authentication). |
| SearxngHeadersResolver | A resolver returning request headers, sync or async. Use this form when the auth token is refreshable — the resolver runs on every search, so a fresh token can be minted per call. |
| SearxngInputMiddlewareFn | An input-pipeline stage. Onion middleware over SearxngRequestContext. |
| SearxngOutputMiddlewareFn | An output-pipeline stage. Onion middleware over SearxngResponseContext. |
| SearxngResultFormat | The output shape the tool serialises. either lets the model pick per call. |
Functions
| Function | Description |
|---|---|
| createSearxngSearchTool | Create a configured SearXNG search Tool. |
References
E_INVALID_SEARXNG_CONFIG
Re-exports E_INVALID_SEARXNG_CONFIG