Skip to content

Commit bc976aa

Browse files
authored
fix(agent): adds all tools from mcp servers during migration (#2283)
1 parent 869c3c1 commit bc976aa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,19 @@ impl ContextMigrate<'c'> {
213213
os.fs.create_dir_all(&global_agent_path).await?;
214214
}
215215

216-
for agent in &new_agents {
216+
let formatted_server_list = mcp_servers
217+
.map(|config| {
218+
config
219+
.mcp_servers
220+
.keys()
221+
.map(|server_name| format!("@{server_name}"))
222+
.collect::<Vec<_>>()
223+
})
224+
.unwrap_or_default();
225+
226+
for agent in &mut new_agents {
227+
agent.tools.extend(formatted_server_list.clone());
228+
217229
let content = serde_json::to_string_pretty(agent)?;
218230
if let Some(path) = agent.path.as_ref() {
219231
info!("Agent {} peristed in path {}", agent.name, path.to_string_lossy());

0 commit comments

Comments
 (0)