use std::path::Path;
use std::sync::Arc;
use oxicode_agent::{
ToolRegistry,
tools::{EditTool, LsTool, ReadTool, WriteTool},
};
pub fn coding_tools(cwd: &Path) -> Arc<ToolRegistry> {
let registry = ToolRegistry::new();
registry.register(ReadTool::with_cwd(cwd.to_path_buf()));
registry.register(WriteTool::with_cwd(cwd.to_path_buf()));
registry.register(EditTool::with_cwd(cwd.to_path_buf()));
registry.register(LsTool::with_cwd(cwd.to_path_buf()));
Arc::new(registry)
}
pub fn readonly_tools(cwd: &Path) -> Arc<ToolRegistry> {
let registry = ToolRegistry::new();
registry.register(ReadTool::with_cwd(cwd.to_path_buf()));
registry.register(LsTool::with_cwd(cwd.to_path_buf()));
Arc::new(registry)
}
pub fn mcp_tools(
cwd: &std::path::Path,
config: Option<oxicode_agent::mcp::McpConfig>,
) -> std::sync::Arc<ToolRegistry> {
use oxicode_agent::mcp::{McpDirectTool, McpManager, McpTool};
let manager = match config {
Some(cfg) => McpManager::spawn_with_config(cfg),
None => {
let _ = cwd; McpManager::spawn()
}
};
let registry = ToolRegistry::new();
for def in manager.direct_tools_from_cache() {
registry.register(McpDirectTool::new(manager.clone(), def));
}
if !manager.should_disable_proxy() {
registry.register(McpTool::new(manager.clone()));
}
registry.set_mcp_manager(manager);
std::sync::Arc::new(registry)
}