Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

agent_ui: JSON encode command path along with other elements in MCPcontext modal (#42693)

Adam Huganirb3478e87f190
diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs
index 669ca54a630..7f85c9a47ea 100644
--- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs
+++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs
@@ -1,7 +1,4 @@
-use std::{
- path::PathBuf,
- sync::{Arc, Mutex},
-};
+use std::sync::{Arc, Mutex};
use anyhow::{Context as _, Result};
use collections::HashMap;
@@ -226,11 +223,12 @@ fn context_server_input(existing: Option<(ContextServerId, ContextServerCommand)
Some((id, cmd)) => {
let args = serde_json::to_string(&cmd.args).unwrap();
let env = serde_json::to_string(&cmd.env.unwrap_or_default()).unwrap();
- (id.0.to_string(), cmd.path, args, env)
+ let cmd_path = serde_json::to_string(&cmd.path).unwrap();
+ (id.0.to_string(), cmd_path, args, env)
}
None => (
"some-mcp-server".to_string(),
- PathBuf::new(),
+ "".to_string(),
"[]".to_string(),
"{}".to_string(),
),
@@ -241,14 +239,13 @@ fn context_server_input(existing: Option<(ContextServerId, ContextServerCommand)
/// The name of your MCP server
"{name}": {{
/// The command which runs the MCP server
- "command": "{}",
+ "command": {command},
/// The arguments to pass to the MCP server
"args": {args},
/// The environment variables to set
"env": {env}
}}
-}}"#,
- command.display()
+}}"#
)
}