Skip to content

Commit 4e0af97

Browse files
committed
delete duplicate api call
1 parent a55ec50 commit 4e0af97

File tree

4 files changed

+6
-27
lines changed

4 files changed

+6
-27
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,6 @@ impl Agents {
421421
);
422422
}
423423

424-
// // Store MCP status in database for later use
425-
// let _ = os.database.settings.set(Setting::McpEnabled, mcp_enabled).await;
426-
427424
// Tracking metadata about the performed load operation.
428425
let mut load_metadata = AgentsLoadMetadata::default();
429426

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,14 @@ use crate::cli::chat::{
1313
ChatSession,
1414
ChatState,
1515
};
16-
use crate::os::Os;
1716

1817
#[deny(missing_docs)]
1918
#[derive(Debug, PartialEq, Args)]
2019
pub struct McpArgs;
2120

2221
impl McpArgs {
23-
pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
24-
let mcp_enabled = match os.client.is_mcp_enabled().await {
25-
Ok(enabled) => enabled,
26-
Err(err) => {
27-
tracing::warn!(?err, "Failed to check MCP configuration, defaulting to enabled");
28-
true
29-
},
30-
};
31-
32-
if !mcp_enabled {
22+
pub async fn execute(self, session: &mut ChatSession) -> Result<ChatState, ChatError> {
23+
if !session.conversation.mcp_enabled {
3324
queue!(
3425
session.stderr,
3526
style::SetForegroundColor(Color::Yellow),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl SlashCommand {
120120
Self::Knowledge(subcommand) => subcommand.execute(os, session).await,
121121
Self::PromptEditor(args) => args.execute(session).await,
122122
Self::Compact(args) => args.execute(os, session).await,
123-
Self::Tools(args) => args.execute(os, session).await,
123+
Self::Tools(args) => args.execute(session).await,
124124
Self::Issue(args) => {
125125
if let Err(err) = args.execute(os).await {
126126
return Err(ChatError::Custom(err.to_string().into()));
@@ -133,7 +133,7 @@ impl SlashCommand {
133133
Self::Prompts(args) => args.execute(session).await,
134134
Self::Hooks(args) => args.execute(session).await,
135135
Self::Usage(args) => args.execute(os, session).await,
136-
Self::Mcp(args) => args.execute(os, session).await,
136+
Self::Mcp(args) => args.execute(session).await,
137137
Self::Model(args) => args.execute(os, session).await,
138138
Self::Subscribe(args) => args.execute(os, session).await,
139139
Self::Persist(subcommand) => subcommand.execute(os, session).await,

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ use crate::cli::chat::{
3333
ChatState,
3434
TRUST_ALL_TEXT,
3535
};
36-
use crate::os::Os;
3736
use crate::util::consts::MCP_SERVER_TOOL_DELIMITER;
3837

3938
#[deny(missing_docs)]
@@ -44,7 +43,7 @@ pub struct ToolsArgs {
4443
}
4544

4645
impl ToolsArgs {
47-
pub async fn execute(self, os: &Os, session: &mut ChatSession) -> Result<ChatState, ChatError> {
46+
pub async fn execute(self, session: &mut ChatSession) -> Result<ChatState, ChatError> {
4847
if let Some(subcommand) = self.subcommand {
4948
return subcommand.execute(session).await;
5049
}
@@ -171,15 +170,7 @@ impl ToolsArgs {
171170
)?;
172171
}
173172

174-
let mcp_enabled = match os.client.is_mcp_enabled().await {
175-
Ok(enabled) => enabled,
176-
Err(err) => {
177-
tracing::warn!(?err, "Failed to check MCP configuration, defaulting to enabled");
178-
true
179-
},
180-
};
181-
182-
if !mcp_enabled {
173+
if !session.conversation.mcp_enabled {
183174
queue!(
184175
session.stderr,
185176
style::SetForegroundColor(Color::Yellow),

0 commit comments

Comments
 (0)