diff --git a/crates/agent/src/agent_profile.rs b/crates/agent/src/agent_profile.rs index 07030c744fc085914ed5d085afd3699482fc6739..2c3b457dc2eef593085bb63ccb42fd70082163b3 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), } } }