MCPcopy Create free account
hub / github.com/AI45Lab/Code / notify

Method notify

core/src/mcp/transport/streamable_http.rs:312–337  ·  view source on GitHub ↗
(&self, notification: JsonRpcNotification)

Source from the content-addressed store, hash-verified

310 }
311
312 async fn notify(&self, notification: JsonRpcNotification) -> Result<()> {
313 if !self.connected.load(Ordering::SeqCst) {
314 return Err(anyhow!("Transport not connected"));
315 }
316
317 let extra_headers = self.request_headers().await;
318 let body = serde_json::to_string(&notification)?;
319
320 let response = self
321 .client
322 .post(&self.url)
323 .headers(extra_headers)
324 .body(body)
325 .send()
326 .await
327 .with_context(|| format!("Streamable HTTP notification to {} failed", self.url))?;
328
329 if !response.status().is_success() {
330 tracing::warn!(
331 status = %response.status(),
332 "Streamable HTTP notification returned non-success status"
333 );
334 }
335
336 Ok(())
337 }
338
339 fn notifications(&self) -> mpsc::Receiver<McpNotification> {
340 let mut rx = self.notification_rx.blocking_write();

Callers 1

Calls 6

with_contextMethod · 0.80
loadMethod · 0.45
request_headersMethod · 0.45
sendMethod · 0.45
postMethod · 0.45
statusMethod · 0.45

Tested by 1