API: providers
better-web-search-mcp / providers
providers#
Interfaces#
AggregateOutcome#
Defined in: src/providers/index.ts:71
What aggregation produced, including why any provider contributed nothing.
Properties#
| Property | Type | Description | Defined in |
|---|---|---|---|
results | SearchResult[] | Results flattened across every provider that answered. | src/providers/index.ts:73 |
warnings | string[] | Human-readable notes about providers that refused or failed. Surfaced so a caller can tell “the search was throttled” from “nothing matched”. Those were previously indistinguishable, which made a working site-restricted query look broken. | src/providers/index.ts:81 |
Variables#
PROVIDER_TIMEOUT_MS#
constPROVIDER_TIMEOUT_MS:10000=10_000
Defined in: src/providers/index.ts:34
Wall-clock budget for a single provider, in milliseconds.
Functions#
aggregateSearch()#
aggregateSearch(
query,opts?):Promise<SearchResult[]>
Defined in: src/providers/index.ts:130
Aggregate search across providers, discarding failure detail.
Parameters#
| Parameter | Type |
|---|---|
query | string |
opts | SearchOptions |
Returns#
Promise<SearchResult[]>
aggregateSearchDetailed()#
aggregateSearchDetailed(
query,opts?):Promise<AggregateOutcome>
Defined in: src/providers/index.ts:90
Aggregate search and report which providers failed.
aggregateSearch keeps the older results-only shape for callers that do not care why a provider was quiet.
Parameters#
| Parameter | Type |
|---|---|
query | string |
opts | SearchOptions |
Returns#
Promise<AggregateOutcome>
enabledProviders()#
enabledProviders():
SearchProvider[]
Defined in: src/providers/index.ts:18
Build the list of enabled providers based on environment keys.
- Brave: enabled when
BRAVE_API_KEY(or BETTER_WEB_SEARCH_BRAVE_API_KEY) is set. - Tavily: enabled when
TAVILY_API_KEY(or BETTER_WEB_SEARCH_TAVILY_API_KEY) is set. - DuckDuckGo: always enabled (keyless free fallback) — zero-config.
SerpApi is deliberately absent: SerpApiProvider is still a stub, so
including it only added a no-op call to every aggregation.