Connect to a registered server, recording success or failure internally. On success the stored error (if any) is cleared; on failure the error message is stored and visible via [`McpManager::get_status`].
(&self, name: &str)
| 66 | /// On success the stored error (if any) is cleared; on failure the error |
| 67 | /// message is stored and visible via [`McpManager::get_status`]. |
| 68 | pub async fn connect(&self, name: &str) -> Result<()> { |
| 69 | let result = self.do_connect(name).await; |
| 70 | match &result { |
| 71 | Ok(_) => { |
| 72 | self.connect_errors.write().await.remove(name); |
| 73 | } |
| 74 | Err(e) => { |
| 75 | self.connect_errors |
| 76 | .write() |
| 77 | .await |
| 78 | .insert(name.to_string(), e.to_string()); |
| 79 | } |
| 80 | } |
| 81 | result |
| 82 | } |
| 83 | |
| 84 | async fn do_connect(&self, name: &str) -> Result<()> { |
| 85 | // Get config |