MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / parse_sse_response

Function parse_sse_response

crates/opencode-tool/src/codesearch.rs:178–193  ·  view source on GitHub ↗
(text: &str)

Source from the content-addressed store, hash-verified

176}
177
178fn 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}

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.45

Tested by

no test coverage detected