From bed6777ce0a50d04c62c4bb739befe62d4a874e7 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 14:51:13 +0000 Subject: [PATCH] agent_ui: JSON encode command path along with other elements in MCPcontext modal (#42693) (cherry-pick to preview) (#43902) Cherry-pick of #42693 to preview ---- Closes #42692 Release Notes: - Fixed command path not being correctly encoded in context server config modal Co-authored-by: Adam Huganir --- .../configure_context_server_modal.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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 a93df3839d98d95e2f91833078dbe96bc3fb8889..6ca79be03c1bd05a7ae733487dc68d01ce08e60a 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; @@ -224,11 +221,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(), ), @@ -239,14 +237,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() +}}"# ) }