use super::mcp_catalog::McpToolCatalog;
use super::tool_registry::ToolRegistry;
use nexo_mcp::SessionMcpRuntime;
use std::sync::Arc;
pub async fn build_session_catalog(runtime: &SessionMcpRuntime) -> Arc<McpToolCatalog> {
build_session_catalog_with_context(runtime, false).await
}
pub async fn build_session_catalog_with_context(
runtime: &SessionMcpRuntime,
context_passthrough: bool,
) -> Arc<McpToolCatalog> {
runtime.touch();
let clients: Vec<_> = runtime.clients().into_iter().map(|(_, c)| c).collect();
Arc::new(McpToolCatalog::build_with_context(clients, context_passthrough).await)
}
pub async fn register_session_tools(runtime: &SessionMcpRuntime, registry: &ToolRegistry) {
register_session_tools_with_context(runtime, registry, false).await
}
pub async fn register_session_tools_with_context(
runtime: &SessionMcpRuntime,
registry: &ToolRegistry,
context_passthrough: bool,
) {
let catalog = build_session_catalog_with_context(runtime, context_passthrough).await;
catalog.register_into(registry);
}
pub async fn register_session_tools_with_overrides(
runtime: &SessionMcpRuntime,
registry: &ToolRegistry,
context_passthrough: bool,
overrides: std::collections::HashMap<String, bool>,
) {
runtime.touch();
let clients: Vec<_> = runtime.clients().into_iter().map(|(_, c)| c).collect();
let catalog = McpToolCatalog::build_with_overrides(clients, context_passthrough, overrides)
.await
.with_resource_cache(runtime.resource_cache())
.with_resource_uri_allowlist(runtime.resource_uri_allowlist());
catalog.register_into(registry);
}