pub async fn try_execute_event_handler(
state: &AppState,
server_id: ServerId,
connection_id: Option<ConnectionId>,
event_type_id: &str,
event_description: &str,
event_data: Option<Value>,
protocol: Option<&dyn Server>,
) -> Result<EventHandlerResult>Expand description
Check and execute event handler for the given event
§Arguments
state- Application stateserver_id- Server ID for contextconnection_id- Optional connection IDevent_type_id- Event type identifier (e.g., “tcp_data_received”)event_description- Human-readable event descriptionevent_data- Structured event data for scriptsprotocol- Optional protocol for action execution
§Returns
Ok(EventHandlerResult::Handled(...))- Handler executed successfullyOk(EventHandlerResult::FallbackToLlm { instruction: None })- No handler or fallback requestedErr(_)- Handler execution failed critically