(text: &str)
| 176 | } |
| 177 | |
| 178 | fn parse_sse_response(text: &str) -> Option<String> { |
| 179 | for line in text.lines() { |
| 180 | if let Some(data) = line.strip_prefix("data: ") { |
| 181 | if let Ok(response) = serde_json::from_str::<McpResponse>(data) { |
| 182 | if let Some(result) = response.result { |
| 183 | if let Some(content) = result.content.first() { |
| 184 | if content.content_type == "text" { |
| 185 | return Some(content.text.clone()); |
| 186 | } |
| 187 | } |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | } |
| 192 | None |
| 193 | } |