PlaygroundController constructor

PlaygroundController({
  1. LlmConfig? initialLlmConfig,
  2. List<McpServerConfig>? initialServers,
  3. List<McpLocalTool>? customLocalTools,
  4. McpPlaygroundStorageDelegate? storageDelegate,
  5. bool enableLogging = false,
})

Creates a new PlaygroundController instance.

Implementation

PlaygroundController({
  LlmConfig? initialLlmConfig,
  List<McpServerConfig>? initialServers,
  List<McpLocalTool>? customLocalTools,
  McpPlaygroundStorageDelegate? storageDelegate,
  this.enableLogging = false,
}) : _llmConfig =
         initialLlmConfig ??
         const LlmConfig(provider: LlmProvider.none, model: '', apiKey: ''),
     _storage = storageDelegate ?? SharedPreferencesStorageDelegate() {
  if (initialServers != null) {
    _servers.addAll(initialServers);
  }
  // Register custom local tools (if any) passed via constructor
  if (customLocalTools != null) {
    _localTools.addAll(customLocalTools);
  }
  _registerEmbeddedLlmHandlers();
  _mcpManager.addListener(notifyListeners);
  _initAndLoad();
}