refactor: Removed the use of the tools.txt file and added tool visibility declarations to the global configuration file
This commit is contained in:
+3
-6
@@ -73,7 +73,6 @@ const FUNCTIONS_DIR_NAME: &str = "functions";
|
||||
const FUNCTIONS_BIN_DIR_NAME: &str = "bin";
|
||||
const AGENTS_DIR_NAME: &str = "agents";
|
||||
const GLOBAL_TOOLS_DIR_NAME: &str = "tools";
|
||||
const GLOBAL_TOOLS_FILE_NAME: &str = "tools.txt";
|
||||
const GLOBAL_TOOLS_UTILS_DIR_NAME: &str = "utils";
|
||||
const BASH_PROMPT_UTILS_FILE_NAME: &str = "prompt-utils.sh";
|
||||
const MCP_FILE_NAME: &str = "mcp.json";
|
||||
@@ -132,6 +131,7 @@ pub struct Config {
|
||||
pub function_calling: bool,
|
||||
pub mapping_tools: IndexMap<String, String>,
|
||||
pub use_tools: Option<String>,
|
||||
pub visible_tools: Option<Vec<String>>,
|
||||
|
||||
pub mcp_servers: bool,
|
||||
pub mapping_mcp_servers: IndexMap<String, String>,
|
||||
@@ -217,6 +217,7 @@ impl Default for Config {
|
||||
function_calling: true,
|
||||
mapping_tools: Default::default(),
|
||||
use_tools: None,
|
||||
visible_tools: None,
|
||||
|
||||
mcp_servers: true,
|
||||
mapping_mcp_servers: Default::default(),
|
||||
@@ -486,10 +487,6 @@ impl Config {
|
||||
Self::functions_dir().join(MCP_FILE_NAME)
|
||||
}
|
||||
|
||||
pub fn global_tools_file() -> PathBuf {
|
||||
Self::functions_dir().join(GLOBAL_TOOLS_FILE_NAME)
|
||||
}
|
||||
|
||||
pub fn global_tools_dir() -> PathBuf {
|
||||
Self::functions_dir().join(GLOBAL_TOOLS_DIR_NAME)
|
||||
}
|
||||
@@ -2828,7 +2825,7 @@ impl Config {
|
||||
}
|
||||
|
||||
fn load_functions(&mut self) -> Result<()> {
|
||||
self.functions = Functions::init()?;
|
||||
self.functions = Functions::init(self.visible_tools.as_ref().unwrap_or(&Vec::new()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user