PlaygroundController class

Controller managing the state of the AI Agent Playground, chat messages, active tool loop execution, and server manager.

Inheritance

Constructors

PlaygroundController({LlmConfig? initialLlmConfig, List<McpServerConfig>? initialServers, List<McpLocalTool>? customLocalTools, McpPlaygroundStorageDelegate? storageDelegate, bool enableLogging = false})
Creates a new PlaygroundController instance.

Properties

activeLlmConfig → LlmConfig
no setter
activeSkill → SkillDef?
no setter
chatMode ↔ bool
getter/setter pair
customLlmConfig ↔ LlmConfig?
getter/setter pair
enabledToolNames → Set<String>
no setter
enableLogging → bool
final
errorMessage → String?
no setter
externalTools → List<MCPTool>
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isGenerating → bool
no setter
isLoading → bool
no setter
llmConfig → LlmConfig
no setter
loadedWorkflowId → String?
no setter
localTools → List<McpLocalTool>
no setter
mcpClients → List<MCPClientDef>
no setter
messageContentBuilder ↔ Widget? Function(BuildContext context, ChatMessage message)?
Optional builder to customize rendering of chat bubble message contents dynamically.
getter/setter pair
messages → List<ChatMessage>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
savedSetups → List<SavedPlaygroundSetup>
no setter
servers → List<McpServerConfig>
no setter
skills → List<SkillDef>
no setter
skillsRootPath → String?
The root directory where skill ZIPs are stored (desktop/mobile only).
no setter
skillStorage → SkillStorageAdapter
The SkillStorageAdapter used for saving/loading skill ZIPs.
no setter
stopAfterToolCall ↔ bool
getter/setter pair
storage → McpPlaygroundStorageDelegate
no setter
systemPrompt ↔ String
getter/setter pair
workflows → List<PlaygroundWorkflow>
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addMessage(ChatMessage message) → void
Adds a message to the conversation history and notifies listeners.
addServer(McpServerConfig server, {bool autoSelectTools = true}) → Future<void>
cancelGeneration() → void
Requests cancellation of the currently executing prompt/sub-prompt chain. Safe to call from any thread.
clearChat() → void
connectServer(String id) → Future<void>
deleteSetup(String id) → Future<void>
deleteSkill(String id) → Future<void>
deleteWorkflow(String id) → Future<void>
dispose() → void
Discards any resources used by the object.
override
initializeAllUndiscoveredServers() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeServer(String id) → Future<void>
saveSetup(SavedPlaygroundSetup setup) → Future<void>
saveSkill(SkillDef skill) → Future<void>
saveWorkflow(PlaygroundWorkflow workflow) → Future<void>
sendMessage(String text, {List<MessageAttachment>? attachments}) → Future<void>
Sends a message and triggers the agentic tool call loop.
setActiveSkill(SkillDef? skill) → void
setLoadedWorkflowId(String? id) → void
setSkillStorageAdapter(SkillStorageAdapter adapter) → void
Allows injecting a custom SkillStorageAdapter (e.g., DB-backed).
syncMcpServers() → Future<void>
toggleServer(String id, bool enabled) → Future<void>
toggleToolEnabled(String toolName, bool enabled) → void
toggleToolsEnabled(Iterable<String> toolNames, bool enabled) → void
toString() → String
A string representation of this object.
inherited
updateEnabledTools(Set<String> toolNames) → void
updateLlmConfig(LlmConfig config) → Future<void>
updateServer(McpServerConfig server) → Future<void>

Operators

operator ==(Object other) → bool
The equality operator.
inherited