API: tools/extract
better-web-search-mcp / tools/extract
tools/extract#
Interfaces#
ExtractResponse#
Defined in: src/tools/extract.ts:39
The spec-shaped per-URL extraction response.
Properties#
| Property | Type | Description | Defined in |
|---|---|---|---|
api_endpoints | unknown | - | src/tools/extract.ts:49 |
content | string | - | src/tools/extract.ts:42 |
extraction | { confidence: number; method: string; rendered: boolean; } | - | src/tools/extract.ts:43 |
extraction.confidence | number | - | src/tools/extract.ts:45 |
extraction.method | string | - | src/tools/extract.ts:44 |
extraction.rendered | boolean | - | src/tools/extract.ts:46 |
metadata | PageMetadata | - | src/tools/extract.ts:50 |
security | SecurityReport | Provenance for the content above. Page text is attacker-controlled, so it is always marked untrusted and screened for text addressing the agent. | src/tools/extract.ts:55 |
structured_data | unknown | - | src/tools/extract.ts:48 |
title | string | - | src/tools/extract.ts:41 |
url | string | - | src/tools/extract.ts:40 |
Variables#
BROWSER_URL_TIMEOUT_MS#
constBROWSER_URL_TIMEOUT_MS:35000=35_000
Defined in: src/tools/extract.ts:62
Per-URL timeout when a browser render may run, in milliseconds.
extractInputSchema#
constextractInputSchema: {browser_fallback:ZodDefault<ZodBoolean>;include_api_data:ZodDefault<ZodBoolean>;include_structured_data:ZodDefault<ZodBoolean>;mode:ZodDefault<ZodEnum<["auto","fast","browser"]>>;urls:ZodArray<ZodString,"many">; }
Defined in: src/tools/extract.ts:30
Input schema for web_extract.
Type Declaration#
| Name | Type | Defined in |
|---|---|---|
browser_fallback | ZodDefault<ZodBoolean> | src/tools/extract.ts:35 |
include_api_data | ZodDefault<ZodBoolean> | src/tools/extract.ts:33 |
include_structured_data | ZodDefault<ZodBoolean> | src/tools/extract.ts:34 |
mode | ZodDefault<ZodEnum<["auto", "fast", "browser"]>> | src/tools/extract.ts:32 |
urls | ZodArray<ZodString, "many"> | src/tools/extract.ts:31 |
URL_TIMEOUT_MS#
constURL_TIMEOUT_MS:8000=8_000
Defined in: src/tools/extract.ts:59
Per-URL timeout when the browser tier cannot run, in milliseconds.
Functions#
registerExtract()#
registerExtract(
server,cache?):void
Defined in: src/tools/extract.ts:205
Register the web_extract tool on the given MCP server.
Parameters#
| Parameter | Type |
|---|---|
server | McpServer |
cache? | Cache |
Returns#
void
runExtract()#
runExtract(
args):Promise<ExtractResponse[]>
Defined in: src/tools/extract.ts:166
Run a bounded-concurrency extraction over the given URLs.
Exported separately so tests and the smoke harness can call the handler logic directly.
Parameters#
| Parameter | Type |
|---|---|
args | { browser_fallback?: boolean; cache?: Cache; include_api_data?: boolean; include_structured_data?: boolean; mode?: "auto" | "browser" | "fast"; urls: string[]; } |
args.browser_fallback? | boolean |
args.cache? | Cache |
args.include_api_data? | boolean |
args.include_structured_data? | boolean |
args.mode? | "auto" | "browser" | "fast" |
args.urls | string[] |
Returns#
Promise<ExtractResponse[]>
timeoutForMode()#
timeoutForMode(
mode,browserFallback):number
Defined in: src/tools/extract.ts:65
The per-URL budget for a given mode / fallback combination.
Parameters#
| Parameter | Type |
|---|---|
mode | "auto" | "browser" | "fast" |
browserFallback | boolean |
Returns#
number