use crate::api::types::Tool;
use serde_json::json;
mod file_io;
mod git;
mod github;
mod system;
mod web;
pub fn get_tools_schemas() -> Vec<Tool> {
get_filtered_tools_schemas(true, true)
}
pub fn get_filtered_tools_schemas(is_git_repo: bool, has_github_token: bool) -> Vec<Tool> {
let mut tools = Vec::with_capacity(40);
system::add_system_schemas(&mut tools);
file_io::add_file_io_schemas(&mut tools);
web::add_web_schemas(&mut tools);
if is_git_repo {
git::add_git_schemas(&mut tools);
}
if has_github_token {
github::add_github_schemas(&mut tools);
}
tools
}
fn create_tool(name: &str, desc: &str, props: serde_json::Value, required: Vec<&str>) -> Tool {
Tool {
r#type: "function".to_string(),
function: crate::api::types::FunctionDefinition {
name: name.to_string(),
description: desc.to_string(),
parameters: json!({
"type": "object",
"properties": props,
"required": required
}),
},
}
}