Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent: Allow to explictly disable tools when using `enable_all_context_servers` (#29414)
Bennet Bo Fenner37fa437990c4
diff --git a/crates/agent/src/assistant_configuration/tool_picker.rs b/crates/agent/src/assistant_configuration/tool_picker.rsindex db52fa8b576..2c48792446e 100644--- a/crates/agent/src/assistant_configuration/tool_picker.rs+++ b/crates/agent/src/assistant_configuration/tool_picker.rs@@ -272,7 +272,7 @@ impl PickerDelegate for ToolPickerDelegate {.get(id.as_ref()).and_then(|preset| preset.tools.get(&tool.name)).copied()- .unwrap_or(false),+ .unwrap_or(self.profile.enable_all_context_servers),};Some(diff --git a/crates/agent/src/thread_store.rs b/crates/agent/src/thread_store.rsindex a907e1d4402..6f7ee0b7c97 100644--- a/crates/agent/src/thread_store.rs+++ b/crates/agent/src/thread_store.rs@@ -494,6 +494,22 @@ impl ThreadStore {);});}+ // Enable all the tools from all context servers, but disable the ones that are explicitly disabled+ for (context_server_id, preset) in &profile.context_servers {+ self.tools.update(cx, |tools, cx| {+ tools.disable(+ ToolSource::ContextServer {+ id: context_server_id.clone().into(),+ },+ &preset+ .tools+ .iter()+ .filter_map(|(tool, enabled)| (!enabled).then(|| tool.clone()))+ .collect::<Vec<_>>(),+ cx,+ )+ })+ }} else {for (context_server_id, preset) in &profile.context_servers {self.tools.update(cx, |tools, cx| {