PlaygroundController constructor

PlaygroundController({
  1. LlmConfig? initialLlmConfig,
  2. List<McpServerConfig>? initialServers,
  3. List<McpLocalTool>? customLocalTools,
  4. McpPlaygroundStorageDelegate? storageDelegate,
  5. bool enableLogging = false,
  6. bool progressiveMcpDiscovery = false,
  7. List<SystemPromptTemplate>? systemPromptTemplates,
  8. bool showSystemPromptTemplates = true,
})

Creates a new PlaygroundController instance.

Implementation

PlaygroundController({
  LlmConfig? initialLlmConfig,
  List<McpServerConfig>? initialServers,
  List<McpLocalTool>? customLocalTools,
  McpPlaygroundStorageDelegate? storageDelegate,
  this.enableLogging = false,
  bool progressiveMcpDiscovery = false,
  this.systemPromptTemplates,
  this.showSystemPromptTemplates = true,
})  : _llmConfig = _sanitizeInitialLlmConfig(initialLlmConfig),
      // ignore: prefer_initializing_formals
      _progressiveMcpDiscovery = progressiveMcpDiscovery,
      _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();
}