git_iris/agents/tools/registry.rs
1//! Tool registry for consistent tool attachment across agents
2//!
3//! This module provides macros and utilities for attaching the standard tool set
4//! to agents in a consistent manner, preventing drift between main agents and subagents.
5
6/// Attach the core analysis tools to an agent builder.
7///
8/// These are the standard tools available to all agents and subagents for
9/// code analysis tasks. Does NOT include delegation tools (`Workspace`, `ParallelAnalyze`,
10/// sub-agent) to prevent recursion.
11///
12/// # Usage
13/// ```ignore
14/// let agent = attach_core_tools!(client.agent(model).preamble("..."));
15/// ```
16#[macro_export]
17macro_rules! attach_core_tools {
18 ($builder:expr) => {{
19 use $crate::agents::debug_tool::DebugTool;
20 use $crate::agents::tools::{
21 CodeSearch, FileRead, GitChangedFiles, GitDiff, GitLog, GitStatus, ProjectDocs,
22 };
23
24 $builder
25 .tool(DebugTool::new(GitStatus))
26 .tool(DebugTool::new(GitDiff))
27 .tool(DebugTool::new(GitLog))
28 .tool(DebugTool::new(GitChangedFiles))
29 .tool(DebugTool::new(FileRead))
30 .tool(DebugTool::new(CodeSearch))
31 .tool(DebugTool::new(ProjectDocs))
32 }};
33}
34
35/// Core tools list for reference - these are the tools attached by `attach_core_tools!`
36pub const CORE_TOOLS: &[&str] = &[
37 "git_status",
38 "git_diff",
39 "git_log",
40 "git_changed_files",
41 "file_read",
42 "code_search",
43 "project_docs",
44];
45
46// Re-export the macro at module level
47pub use attach_core_tools;
48
49#[cfg(test)]
50mod tests {
51 use super::*;
52
53 #[test]
54 fn core_tools_count() {
55 assert_eq!(CORE_TOOLS.len(), 7);
56 }
57}