fix: reduce code duplication by reusing the new concrete_tool_names function in .list tools
CI / All (ubuntu-latest) (push) Failing after 25s
CI / All (macos-latest) (push) Has been cancelled
CI / All (windows-latest) (push) Has been cancelled

This commit is contained in:
2026-07-17 15:51:01 -06:00
parent a606ea552d
commit c979041161
+12 -11
View File
@@ -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();