ares-tools 0.11.0

Built-in tools for ARES agents
Documentation
//! Built-in agent tools for A.R.E.S.

pub mod config;
pub use config::ToolConfig;

pub mod calculator;
pub mod fence;
pub mod http_tool;
pub mod plugins;
pub(crate) mod registry;
#[cfg(feature = "script-tools")]
pub mod rhai_tool;
#[cfg(feature = "script-tools")]
pub mod script_tool;
pub mod tool_service;
pub mod tools;

#[cfg(any(feature = "postgres", test))]
pub(crate) mod runtime_registry;

#[cfg(any(feature = "postgres", test))]
pub(crate) use runtime_registry::RuntimeToolRegistry;

#[cfg(any(feature = "postgres", test))]
pub mod sql_tool;

#[cfg(any(feature = "search-tools", test))]
pub mod search;

#[cfg(any(feature = "search-tools", test))]
pub mod web_scrape;

#[cfg(any(feature = "mcp", test))]
pub mod mcp_bridge;

#[cfg(any(feature = "postgres", test))]
pub mod connectors;

pub use calculator::{Calculator, CalculatorConfig, CalculatorService};
pub use tools::provider_web_search::ProviderWebSearch;
pub use plugins::register_plugins;
pub use registry::Tool;
#[cfg(feature = "script-tools")]
pub use rhai_tool::{RhaiTool, RhaiToolConfig};
pub use tool_service::Tools;

#[cfg(test)]
mod tests {
    use super::{calculator::Calculator, ProviderWebSearch, Tool, Tools};
    use std::sync::Arc;

    #[test]
    fn calculator_and_tools_are_wired() {
        let tools = Tools::from_static([Arc::new(Calculator) as Arc<dyn Tool>]);
        let ctx = cordis::Context::new_root();
        assert!(tools.resolve(&ctx, "calculator").is_some());
        assert!(tools
            .list(&ctx)
            .iter()
            .any(|definition| definition.name == "calculator"));
    }

    #[test]
    fn provider_web_search_is_always_on_and_distinct_from_daedra() {
        let tools = Tools::from_static([
            Arc::new(Calculator) as Arc<dyn Tool>,
            Arc::new(ProviderWebSearch) as Arc<dyn Tool>,
        ]);
        let ctx = cordis::Context::new_root();
        let tool = tools
            .resolve(&ctx, "provider_web_search")
            .expect("provider_web_search should resolve");
        assert_eq!(tool.name(), "provider_web_search");
        assert_eq!(crate::search::WebSearch::new().name(), "web_search");
        assert_ne!(tool.name(), crate::search::WebSearch::new().name());
    }

    #[test]
    fn search_and_scrape_modules_compile_under_test_cfg() {
        let _ = std::any::type_name::<crate::search::WebSearch>();
        let _ = std::any::type_name::<crate::web_scrape::WebScrape>();
    }
}