a3s_code_core/tools/builtin/
mod.rs1mod bash;
7pub mod batch;
8mod edit;
9mod git;
10mod glob_tool;
11mod grep;
12mod ls;
13mod patch;
14mod read;
15mod web_fetch;
16mod web_search;
17mod write;
18
19use super::registry::ToolRegistry;
20use std::sync::Arc;
21
22pub fn register_builtins(registry: &ToolRegistry) {
27 registry.register_builtin(Arc::new(read::ReadTool));
28 registry.register_builtin(Arc::new(write::WriteTool));
29 registry.register_builtin(Arc::new(edit::EditTool));
30 registry.register_builtin(Arc::new(patch::PatchTool));
31 registry.register_builtin(Arc::new(bash::BashTool));
32 registry.register_builtin(Arc::new(grep::GrepTool));
33 registry.register_builtin(Arc::new(glob_tool::GlobTool));
34 registry.register_builtin(Arc::new(ls::LsTool));
35 registry.register_builtin(Arc::new(web_fetch::WebFetchTool));
36 registry.register_builtin(Arc::new(web_search::WebSearchTool));
37 registry.register_builtin(Arc::new(git::GitTool));
38}
39
40pub fn register_batch(registry: &Arc<ToolRegistry>) {
42 registry.register_builtin(Arc::new(batch::BatchTool::new(Arc::clone(registry))));
43}
44
45pub fn register_task(
51 registry: &Arc<ToolRegistry>,
52 llm_client: Arc<dyn crate::llm::LlmClient>,
53 agent_registry: Arc<crate::subagent::AgentRegistry>,
54 workspace: String,
55) {
56 register_task_with_mcp(registry, llm_client, agent_registry, workspace, None);
57}
58
59pub fn register_task_with_mcp(
64 registry: &Arc<ToolRegistry>,
65 llm_client: Arc<dyn crate::llm::LlmClient>,
66 agent_registry: Arc<crate::subagent::AgentRegistry>,
67 workspace: String,
68 mcp_manager: Option<Arc<crate::mcp::manager::McpManager>>,
69) {
70 use crate::tools::task::{ParallelTaskTool, RunTeamTool, TaskExecutor, TaskTool};
71 let executor = Arc::new(match mcp_manager {
72 Some(mcp) => TaskExecutor::with_mcp(agent_registry, llm_client, workspace, mcp),
73 None => TaskExecutor::new(agent_registry, llm_client, workspace),
74 });
75 registry.register_builtin(Arc::new(TaskTool::new(Arc::clone(&executor))));
76 registry.register_builtin(Arc::new(ParallelTaskTool::new(Arc::clone(&executor))));
77 registry.register_builtin(Arc::new(RunTeamTool::new(executor)));
78}
79
80pub fn register_skill(
82 registry: &Arc<ToolRegistry>,
83 llm_client: Arc<dyn crate::llm::LlmClient>,
84 skill_registry: Arc<crate::skills::SkillRegistry>,
85 tool_executor: Arc<crate::tools::ToolExecutor>,
86 base_config: crate::agent::AgentConfig,
87) {
88 use crate::tools::skill::SkillTool;
89 registry.register_builtin(Arc::new(SkillTool::new(
90 skill_registry,
91 llm_client,
92 tool_executor,
93 base_config,
94 )));
95}