fix: reduce code duplication by reusing the new concrete_tool_names function in .list tools
This commit is contained in:
@@ -2362,20 +2362,21 @@ impl RequestContext {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
"tools" => {
|
"tools" => {
|
||||||
let mut names: Vec<String> = self
|
let mut names = self.concrete_tool_names();
|
||||||
.tool_scope
|
let aliases: Vec<String> = self
|
||||||
.functions
|
.app
|
||||||
.declarations()
|
.config
|
||||||
|
.mapping_tools
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|v| {
|
.filter(|(_, expansion)| {
|
||||||
!v.name.starts_with("user__")
|
expansion
|
||||||
&& !v.name.starts_with("mcp_")
|
.split(',')
|
||||||
&& !v.name.starts_with("todo__")
|
.map(str::trim)
|
||||||
&& !v.name.starts_with("agent__")
|
.any(|v| names.iter().any(|p| p.as_str() == v))
|
||||||
})
|
})
|
||||||
.map(|v| v.name.clone())
|
.map(|(k, _)| k.clone())
|
||||||
.collect();
|
.collect();
|
||||||
names.extend(self.app.config.mapping_tools.keys().map(|v| v.to_string()));
|
names.extend(aliases);
|
||||||
names.sort_unstable();
|
names.sort_unstable();
|
||||||
names.dedup();
|
names.dedup();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user