( http: HttpClient.HttpClient, provider: WebSearchProvider, params: Schema.Schema.Type<typeof Parameters>, ctx: Tool.Context, )
| 58 | } |
| 59 | |
| 60 | function callProvider( |
| 61 | http: HttpClient.HttpClient, |
| 62 | provider: WebSearchProvider, |
| 63 | params: Schema.Schema.Type<typeof Parameters>, |
| 64 | ctx: Tool.Context, |
| 65 | ) { |
| 66 | if (provider === "parallel") { |
| 67 | return McpWebSearch.call( |
| 68 | http, |
| 69 | McpWebSearch.PARALLEL_URL, |
| 70 | "web_search", |
| 71 | McpWebSearch.ParallelSearchArgs, |
| 72 | { |
| 73 | objective: params.query, |
| 74 | search_queries: [params.query], |
| 75 | session_id: ctx.sessionID, |
| 76 | model_name: webSearchModelName(ctx.extra), |
| 77 | }, |
| 78 | "25 seconds", |
| 79 | parallelAuthHeaders(), |
| 80 | ) |
| 81 | } |
| 82 | |
| 83 | return McpWebSearch.call( |
| 84 | http, |
| 85 | McpWebSearch.EXA_URL, |
| 86 | "web_search_exa", |
| 87 | McpWebSearch.SearchArgs, |
| 88 | { |
| 89 | query: params.query, |
| 90 | type: params.type || "auto", |
| 91 | numResults: params.numResults || 8, |
| 92 | livecrawl: params.livecrawl || "fallback", |
| 93 | contextMaxCharacters: params.contextMaxCharacters, |
| 94 | }, |
| 95 | "25 seconds", |
| 96 | ) |
| 97 | } |
| 98 | |
| 99 | export const WebSearchTool = Tool.define( |
| 100 | "websearch", |
no test coverage detected