Skip to content

Commit d0670b2

Browse files
committed
set mcp_enabled value after load
1 parent 4e0af97 commit d0670b2

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

crates/chat-cli/src/api_client/mod.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -336,19 +336,18 @@ impl ApiClient {
336336
}
337337

338338
pub async fn is_mcp_enabled(&self) -> Result<bool, ApiClientError> {
339-
// let request = self
340-
// .client
341-
// .get_profile()
342-
// .set_profile_arn(self.profile.as_ref().map(|p| p.arn.clone()));
343-
344-
// let response = request.send().await?;
345-
// let mcp_enabled = response
346-
// .profile()
347-
// .opt_in_features()
348-
// .and_then(|features| features.mcp_configuration())
349-
// .is_none_or(|config| matches!(config.toggle(), OptInFeatureToggle::On));
350-
// Ok(mcp_enabled)
351-
Ok(false)
339+
let request = self
340+
.client
341+
.get_profile()
342+
.set_profile_arn(self.profile.as_ref().map(|p| p.arn.clone()));
343+
344+
let response = request.send().await?;
345+
let mcp_enabled = response
346+
.profile()
347+
.opt_in_features()
348+
.and_then(|features| features.mcp_configuration())
349+
.is_none_or(|config| matches!(config.toggle(), OptInFeatureToggle::On));
350+
Ok(mcp_enabled)
352351
}
353352

354353
pub async fn create_subscription_token(&self) -> Result<CreateSubscriptionTokenOutput, ApiClientError> {

crates/chat-cli/src/cli/agent/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ fn default_schema() -> String {
849849
"https://raw.githubusercontent.com/aws/amazon-q-developer-cli/refs/heads/main/schemas/agent-v1.json".into()
850850
}
851851

852-
fn is_mcp_ref(s: &str) -> bool {
852+
pub fn is_mcp_ref(s: &str) -> bool {
853853
// Any tool reference starting with '@' is considered MCP (e.g., "@git", "@git/git_status").
854854
s.starts_with('@')
855855
}

crates/chat-cli/src/cli/chat/cli/persist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ impl PersistSubcommand {
9595

9696
let mut new_state: ConversationState = tri!(serde_json::from_str(&contents), "import from", &path);
9797
std::mem::swap(&mut new_state.tool_manager, &mut session.conversation.tool_manager);
98+
std::mem::swap(&mut new_state.mcp_enabled, &mut session.conversation.mcp_enabled);
99+
std::mem::swap(&mut new_state.model_info, &mut session.conversation.model_info);
98100
std::mem::swap(
99101
&mut new_state.context_manager,
100102
&mut session.conversation.context_manager,

0 commit comments

Comments
 (0)