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

Method restart

crates/opencode-mcp/src/client.rs:878–914  ·  view source on GitHub ↗
(&self, name: &str)

Source from the content-addressed store, hash-verified

876 }
877
878 pub async fn restart(&self, name: &str) -> Result<Arc<McpClient>, McpClientError> {
879 self.log_event(name, "Restart requested").await;
880
881 let config = self
882 .connection_configs
883 .read()
884 .await
885 .get(name)
886 .cloned()
887 .ok_or_else(|| {
888 McpClientError::ProtocolError(format!("No restart config found for {}", name))
889 })?;
890
891 if let Some(client) = self.clients.write().await.remove(name) {
892 client.close().await?;
893 }
894
895 match config {
896 RegistryConnectionConfig::Stdio(config) => self.add_stdio(config).await,
897 RegistryConnectionConfig::Http {
898 url,
899 headers,
900 timeout_ms,
901 } => {
902 self.add_http(name.to_string(), url, headers, timeout_ms)
903 .await
904 }
905 RegistryConnectionConfig::Sse {
906 url,
907 headers,
908 timeout_ms,
909 } => {
910 self.add_sse(name.to_string(), url, headers, timeout_ms)
911 .await
912 }
913 }
914 }
915}
916
917impl Default for McpClientRegistry {

Callers

nothing calls this directly

Calls 8

readMethod · 0.80
add_stdioMethod · 0.80
add_httpMethod · 0.80
add_sseMethod · 0.80
log_eventMethod · 0.45
getMethod · 0.45
removeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected