API: tools/news

better-web-search-mcp


better-web-search-mcp / tools/news

tools/news#

Interfaces#

NewsResponse#

Defined in: src/tools/news.ts:33

The spec-shaped web_news response.

Properties#

PropertyTypeDescriptionDefined in
answerstring-src/tools/news.ts:34
queries_usedstring[]-src/tools/news.ts:37
recency_verifiedbooleanWhether every returned source carried a publication date inside the requested window. False means the results are topical but their age is unknown, which happens on the keyless path: DuckDuckGo’s HTML endpoint does not supply dates. An agent should not describe those as “from the last N days”.src/tools/news.ts:48
sourcesSearchSource[]-src/tools/news.ts:35
timelineRecord<string, SearchSource[]>-src/tools/news.ts:36
warnings?string[]Providers that refused or failed, so an empty result reads correctly.src/tools/news.ts:39

Variables#

newsInputSchema#

const newsInputSchema: { max_results: ZodDefault<ZodNumber>; recency_days: ZodDefault<ZodNumber>; topic: ZodString; }

Defined in: src/tools/news.ts:26

Input schema for web_news.

Type Declaration#

NameTypeDefined in
max_resultsZodDefault<ZodNumber>src/tools/news.ts:29
recency_daysZodDefault<ZodNumber>src/tools/news.ts:28
topicZodStringsrc/tools/news.ts:27

Functions#

registerNews()#

registerNews(server, cache?): void

Defined in: src/tools/news.ts:191

Register the web_news tool on the given MCP server.

Parameters#

ParameterType
serverMcpServer
cache?Cache

Returns#

void


runNews()#

runNews(args): Promise<NewsResponse>

Defined in: src/tools/news.ts:101

Run a recency-filtered news search and return the spec-shaped response.

Exported separately so tests and the smoke harness can call the handler logic directly.

Parameters#

ParameterType
args{ cache?: Cache; max_results?: number; recency_days?: number; topic: string; }
args.cache?Cache
args.max_results?number
args.recency_days?number
args.topicstring

Returns#

Promise<NewsResponse>