PreviewLabMcpBridge
interface PreviewLabMcpBridge
Bridge interface for communicating PreviewLab state to MCP server.
This interface allows PreviewLab to expose its fields, events, and screenshot functionality to external MCP (Model Context Protocol) servers without direct dependency on MCP implementation.
Functions
Link copied to clipboard
Called when a PreviewLab instance is disposed. Implementations should remove the corresponding MCP resources.
Link copied to clipboard
abstract fun updateState(previewId: String, fields: List<PreviewLabField<*>>, events: List<PreviewLabEvent>, captureScreenshot: suspend () -> ImageBitmap?, onUpdateField: (label: String, serializedValue: String) -> Boolean, onClearEvents: () -> Unit)
Called when the PreviewLab state changes. Implementations should update MCP resources accordingly.