Skip to main content

mofa_plugins/tools/
mod.rs

1//! Built-in tools module
2//!
3//! Provides a collection of commonly used tools that can be registered
4//! with the ToolPlugin.
5
6pub use crate::{
7    AgentPlugin, PluginResult, ToolCall, ToolDefinition, ToolExecutor, ToolPlugin, ToolResult,
8};
9
10// Individual tool implementations
11pub mod calculator;
12pub mod datetime;
13mod duck_search;
14pub mod filesystem;
15pub mod http;
16pub mod json;
17pub mod medical_knowledge;
18mod postgres;
19pub mod response_optimizer;
20pub mod rhai;
21pub mod shell;
22mod web_scrapper;
23
24pub use calculator::CalculatorTool;
25pub use datetime::DateTimeTool;
26pub use filesystem::FileSystemTool;
27/// Re-export all tools
28pub use http::HttpRequestTool;
29pub use json::JsonTool;
30pub use medical_knowledge::MedicalKnowledgeTool;
31pub use response_optimizer::ResponseOptimizerTool;
32pub use rhai::RhaiScriptTool;
33pub use shell::ShellCommandTool;
34
35/// Convenience function to create a ToolPlugin with all built-in tools
36pub fn create_builtin_tool_plugin(plugin_id: &str) -> PluginResult<ToolPlugin> {
37    let mut tool_plugin = ToolPlugin::new(plugin_id);
38
39    // Register all built-in tools
40    tool_plugin.register_tool(HttpRequestTool::new());
41    tool_plugin.register_tool(FileSystemTool::new_with_defaults()?);
42    tool_plugin.register_tool(ShellCommandTool::new_with_defaults());
43    tool_plugin.register_tool(DateTimeTool::new());
44    tool_plugin.register_tool(CalculatorTool::new());
45    tool_plugin.register_tool(RhaiScriptTool::new()?);
46    tool_plugin.register_tool(JsonTool::new());
47    tool_plugin.register_tool(ResponseOptimizerTool::new());
48    tool_plugin.register_tool(MedicalKnowledgeTool::new());
49
50    Ok(tool_plugin)
51}