From c9790411617e83d66c6aacb17e3508a1bae38c8c Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Fri, 17 Jul 2026 15:51:01 -0600 Subject: [PATCH] fix: reduce code duplication by reusing the new concrete_tool_names function in .list tools --- src/config/request_context.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/config/request_context.rs b/src/config/request_context.rs index 51187aa..85c363e 100644 --- a/src/config/request_context.rs +++ b/src/config/request_context.rs @@ -2362,20 +2362,21 @@ impl RequestContext { Ok(()) } "tools" => { - let mut names: Vec = self - .tool_scope - .functions - .declarations() + let mut names = self.concrete_tool_names(); + let aliases: Vec = self + .app + .config + .mapping_tools .iter() - .filter(|v| { - !v.name.starts_with("user__") - && !v.name.starts_with("mcp_") - && !v.name.starts_with("todo__") - && !v.name.starts_with("agent__") + .filter(|(_, expansion)| { + expansion + .split(',') + .map(str::trim) + .any(|v| names.iter().any(|p| p.as_str() == v)) }) - .map(|v| v.name.clone()) + .map(|(k, _)| k.clone()) .collect(); - names.extend(self.app.config.mapping_tools.keys().map(|v| v.to_string())); + names.extend(aliases); names.sort_unstable(); names.dedup();