feat: improve tool loading (#2193)

This commit is contained in:
Yingjie He
2025-04-14 20:10:07 -07:00
committed by GitHub
parent b80f2b9bb7
commit 167ac0efdc
6 changed files with 91 additions and 68 deletions
+1 -9
View File
@@ -203,17 +203,9 @@ async fn get_tools(
let permission_manager = PermissionManager::default();
let mut tools: Vec<ToolInfo> = agent
.list_tools()
.list_tools(query.extension_name)
.await
.into_iter()
.filter(|tool| {
// Apply the filter only if the extension name is present in the query
if let Some(extension_name) = &query.extension_name {
tool.name.starts_with(extension_name)
} else {
true
}
})
.map(|tool| {
let permission = permission_manager
.get_user_permission(&tool.name)