a3s_code_core/tools/builtin/
mod.rs1pub(crate) mod agentic_parse;
13pub(crate) mod agentic_search;
14mod bash;
15pub mod batch;
16mod edit;
17mod git_worktree;
18mod glob_tool;
19mod grep;
20mod ls;
21mod patch;
22mod read;
23mod web_fetch;
24mod web_search;
25mod write;
26
27use super::registry::ToolRegistry;
28use std::sync::Arc;
29
30pub fn register_builtins(registry: &ToolRegistry) {
38 registry.register_builtin(Arc::new(read::ReadTool));
39 registry.register_builtin(Arc::new(write::WriteTool));
40 registry.register_builtin(Arc::new(edit::EditTool));
41 registry.register_builtin(Arc::new(patch::PatchTool));
42 registry.register_builtin(Arc::new(bash::BashTool));
43 registry.register_builtin(Arc::new(grep::GrepTool));
44 registry.register_builtin(Arc::new(glob_tool::GlobTool));
45 registry.register_builtin(Arc::new(ls::LsTool));
46 registry.register_builtin(Arc::new(web_fetch::WebFetchTool));
47 registry.register_builtin(Arc::new(web_search::WebSearchTool));
48 registry.register_builtin(Arc::new(git_worktree::GitWorktreeTool));
49}
50
51pub fn register_batch(registry: &Arc<ToolRegistry>) {
53 registry.register_builtin(Arc::new(batch::BatchTool::new(Arc::clone(registry))));
54}
55
56pub fn register_agentic_tools(
66 registry: &Arc<ToolRegistry>,
67 llm: Option<Arc<dyn crate::llm::LlmClient>>,
68) {
69 registry.register_builtin(Arc::new(agentic_search::AgenticSearchTool::new()));
70 if let Some(llm_client) = llm {
71 registry.register_builtin(Arc::new(agentic_parse::AgenticParseTool::new(llm_client)));
72 }
73}
74
75pub fn register_task(
81 registry: &Arc<ToolRegistry>,
82 llm_client: Arc<dyn crate::llm::LlmClient>,
83 agent_registry: Arc<crate::subagent::AgentRegistry>,
84 workspace: String,
85) {
86 register_task_with_mcp(registry, llm_client, agent_registry, workspace, None);
87}
88
89pub fn register_task_with_mcp(
94 registry: &Arc<ToolRegistry>,
95 llm_client: Arc<dyn crate::llm::LlmClient>,
96 agent_registry: Arc<crate::subagent::AgentRegistry>,
97 workspace: String,
98 mcp_manager: Option<Arc<crate::mcp::manager::McpManager>>,
99) {
100 use crate::tools::task::{ParallelTaskTool, RunTeamTool, TaskExecutor, TaskTool};
101 let executor = Arc::new(match mcp_manager {
102 Some(mcp) => TaskExecutor::with_mcp(agent_registry, llm_client, workspace, mcp),
103 None => TaskExecutor::new(agent_registry, llm_client, workspace),
104 });
105 registry.register_builtin(Arc::new(TaskTool::new(Arc::clone(&executor))));
106 registry.register_builtin(Arc::new(ParallelTaskTool::new(Arc::clone(&executor))));
107 registry.register_builtin(Arc::new(RunTeamTool::new(executor)));
108}
109
110pub fn register_skill(
112 registry: &Arc<ToolRegistry>,
113 llm_client: Arc<dyn crate::llm::LlmClient>,
114 skill_registry: Arc<crate::skills::SkillRegistry>,
115 tool_executor: Arc<crate::tools::ToolExecutor>,
116 base_config: crate::agent::AgentConfig,
117) {
118 use crate::tools::skill::SkillTool;
119 registry.register_builtin(Arc::new(SkillTool::new(
120 skill_registry,
121 llm_client,
122 tool_executor,
123 base_config,
124 )));
125}