use std::sync::Arc;
use axum::extract::FromRef;
use embacle::{FunctionDeclaration, McpToolExecutor};
pub use embacle_mcp::state::{ServerState, SharedState};
#[derive(Clone)]
pub struct ServerTools {
pub executor: Arc<dyn McpToolExecutor>,
pub declarations: Vec<FunctionDeclaration>,
}
#[derive(Clone)]
pub struct AppState {
pub shared: SharedState,
pub server_tools: Option<ServerTools>,
}
impl AppState {
pub fn new(shared: SharedState) -> Self {
Self {
shared,
server_tools: None,
}
}
pub fn with_server_tools(mut self, tools: Option<ServerTools>) -> Self {
self.server_tools = tools;
self
}
}
impl FromRef<AppState> for SharedState {
fn from_ref(app: &AppState) -> Self {
app.shared.clone()
}
}