BraveSearch

BraveSearch — Web search via Brave Search API

Provides internet search capabilities for the AI model. When the model needs up-to-date information it can emit a CALL:search(query='...') marker. The servlet layer detects this, calls search, and feeds the results back into the conversation so the model can produce a grounded answer.

Configuration

PropertyFormatExample
AI_BraveSearch_ApiKeyAPI key stringBSA...xyz
AI_BraveSearch_MaxResultsInteger (1–20)5

API docs: https://api.search.brave.com/app/documentation/web-search

Domains to whitelist

  • api.search.brave.com — Brave Search API endpoint

Types

Link copied to clipboard
data class SearchResult(val title: String, val url: String, val description: String, val extraSnippets: List<String> = emptyList())

A single web search result.

Properties

Link copied to clipboard

The API key — set during plugin initialisation.

Link copied to clipboard

Matches CALL:search(query='...'), CALL:search(query="..."), or positional CALL:search('...') / CALL:search("...") in model output.

Link copied to clipboard

Whether to filter sensitive data from queries (default: false, set by plugin property).

Link copied to clipboard

Whether web search is available (API key configured).

Link copied to clipboard

Maximum number of results to return (configurable via AI_BraveSearch_MaxResults).

Functions

Link copied to clipboard

Formats search results into a text block suitable for injecting into a conversation.

Link copied to clipboard
fun sanitizeQuery(raw: String, language: String? = null, filterOverride: Boolean? = null): String

Sanitizes a search query by removing personally identifiable information (PII) and identifiers that should not be forwarded to an external search engine. Serves as a second layer of defense in addition to possible instructions in the prompt to the model to avoid including sensitive information in the query.

Link copied to clipboard
fun search(query: String, country: String? = null, language: String? = null, filterOverride: Boolean? = null): List<BraveSearch.SearchResult>

Searches the web using the Brave Search API.