(text: &str)
| 231 | } |
| 232 | |
| 233 | fn parse_sse_response(text: &str) -> Option<String> { |
| 234 | for line in text.lines() { |
| 235 | if let Some(data) = line.strip_prefix("data: ") { |
| 236 | if let Ok(response) = serde_json::from_str::<McpSearchResponse>(data) { |
| 237 | if !response.result.content.is_empty() { |
| 238 | return Some(response.result.content[0].text.clone()); |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | } |
| 243 | None |
| 244 | } |
| 245 | |
| 246 | impl Default for WebSearchTool { |
| 247 | fn default() -> Self { |