WebSearchTool

class WebSearchTool @JvmOverloads constructor(allowPrivateNetwork: Boolean = false) : McpTool

Searches the web by scraping DuckDuckGo's HTML endpoint (html.duckduckgo.com) with OkHttp and parsing results with Jsoup. Reaches the network (openWorldHint); requires INTERNET (always-granted). Results depend on DuckDuckGo's HTML structure (.result / .result__a / .result__snippet) — a markup change can yield zero parsed results without an error. Any HTTP or parse failure is caught and returned as a ToolResult.error; a non-2xx status returns an error too. Shares the web module's client setup (15 s connect/read, 30 s call timeout, SSRF guard on every redirect hop — see NetworkGuard).

Output map: query (echoed), results (List<Map> each with title/url/snippet), result_count (Int).

Parameters

allowPrivateNetwork

when true, disables the SSRF guard (default false).

Constructors

Link copied to clipboard
constructor(allowPrivateNetwork: Boolean = false)

Properties

Link copied to clipboard
open override val annotations: ToolAnnotations
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val outputSchema: Map<String, Any>
Link copied to clipboard
open override val parameters: List<ToolParameter>

Functions

Link copied to clipboard
open suspend override fun execute(params: Map<String, Any>): ToolResult