(&self, params: JsWebSearchParams)
| 3828 | /// Search the web using multiple search engines. |
| 3829 | #[napi] |
| 3830 | pub async fn web_search(&self, params: JsWebSearchParams) -> napi::Result<ToolResult> { |
| 3831 | let session = self.inner.clone(); |
| 3832 | let args = serde_json::json!({ |
| 3833 | "query": params.query, |
| 3834 | "engines": params.engines, |
| 3835 | "limit": params.limit, |
| 3836 | "timeout": params.timeout, |
| 3837 | "proxy": params.proxy, |
| 3838 | "format": params.format, |
| 3839 | }); |
| 3840 | get_runtime() |
| 3841 | .spawn(async move { |
| 3842 | session.tool("web_search", args).await.map(|r| ToolResult { |
| 3843 | name: r.name, |
| 3844 | output: r.output, |
| 3845 | exit_code: r.exit_code, |
| 3846 | metadata_json: r.metadata.and_then(|m| serde_json::to_string(&m).ok()), |
| 3847 | document_runtime_json: None, |
| 3848 | error_kind_json: r |
| 3849 | .error_kind |
| 3850 | .as_ref() |
| 3851 | .and_then(|k| serde_json::to_string(k).ok()), |
| 3852 | }) |
| 3853 | }) |
| 3854 | .await |
| 3855 | .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))? |
| 3856 | .map_err(|e| napi::Error::from_reason(format!("{e}"))) |
| 3857 | } |
| 3858 | |
| 3859 | /// Execute a git command. |
| 3860 | /// |
nothing calls this directly
no test coverage detected