(ctx context.Context)
| 145 | } |
| 146 | |
| 147 | func (c *McpClient) Disconnect(ctx context.Context) { |
| 148 | c.mu.Lock() |
| 149 | c.stopPingLocked() |
| 150 | transport := c.transport |
| 151 | c.transport = nil |
| 152 | c.state = ConnectionDisconnected |
| 153 | c.mu.Unlock() |
| 154 | if transport != nil { |
| 155 | _ = transport.Close(ctx) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func (c *McpClient) Reconnect(ctx context.Context) bool { |
| 160 | c.Disconnect(ctx) |