assistant2: Allow profiles to manage context server tools (#27452)

This PR updates the agent profiles with support for managing context
server tools.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2025-03-25 15:55:59 -04:00 committed by GitHub
parent aab02a4166
commit 5953c6167b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 34 additions and 4 deletions

View file

@ -9,12 +9,10 @@ pub struct AgentProfile {
/// The name of the profile.
pub name: SharedString,
pub tools: IndexMap<Arc<str>, bool>,
#[allow(dead_code)]
pub context_servers: IndexMap<Arc<str>, ContextServerPreset>,
}
#[derive(Debug, Clone)]
pub struct ContextServerPreset {
#[allow(dead_code)]
pub tools: IndexMap<Arc<str>, bool>,
}

View file

@ -412,6 +412,13 @@ impl Default for LanguageModelSelection {
pub struct AgentProfileContent {
pub name: Arc<str>,
pub tools: IndexMap<Arc<str>, bool>,
#[serde(default)]
pub context_servers: IndexMap<Arc<str>, ContextServerPresetContent>,
}
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize, JsonSchema)]
pub struct ContextServerPresetContent {
pub tools: IndexMap<Arc<str>, bool>,
}
#[derive(Clone, Serialize, Deserialize, JsonSchema, Debug)]
@ -522,7 +529,18 @@ impl Settings for AssistantSettings {
AgentProfile {
name: profile.name.into(),
tools: profile.tools,
context_servers: IndexMap::default(),
context_servers: profile
.context_servers
.into_iter()
.map(|(context_server_id, preset)| {
(
context_server_id,
ContextServerPreset {
tools: preset.tools.clone(),
},
)
})
.collect(),
},
)
}));