Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Allow disabling tools when 'enable_all_context_servers = true' (#33536)

Peter Trippbdf29bf76f7b
diff --git a/crates/agent/src/agent_profile.rs b/crates/agent/src/agent_profile.rs
index 07030c744fc..2c3b457dc2e 100644
--- a/crates/agent/src/agent_profile.rs
+++ b/crates/agent/src/agent_profile.rs
@@ -96,16 +96,11 @@ impl AgentProfile {
fn is_enabled(settings: &AgentProfileSettings, source: ToolSource, name: String) -> bool {
match source {
ToolSource::Native => *settings.tools.get(name.as_str()).unwrap_or(&false),
- ToolSource::ContextServer { id } => {
- if settings.enable_all_context_servers {
- return true;
- }
-
- let Some(preset) = settings.context_servers.get(id.as_ref()) else {
- return false;
- };
- *preset.tools.get(name.as_str()).unwrap_or(&false)
- }
+ ToolSource::ContextServer { id } => settings
+ .context_servers
+ .get(id.as_ref())
+ .and_then(|preset| preset.tools.get(name.as_str()).copied())
+ .unwrap_or(settings.enable_all_context_servers),
}
}
}