refreshTools method

Future<void> refreshTools(
  1. String serverName
)

Reload tools from a connected server.

Implementation

Future<void> refreshTools(String serverName) async {
  final connection = _connections[serverName];
  if (connection is! ConnectedMcpServer) return;

  _unregisterMcpTools(serverName);

  try {
    final tools = await _fetchTools(serverName);
    _connections[serverName] = ConnectedMcpServer(
      serverName: serverName,
      config: connection.config,
      tools: tools,
      resources: connection.resources,
    );
    _registerMcpTools(_connections[serverName] as ConnectedMcpServer);
  } catch (_) {
    // Keep existing connection state
  }
}