agent_ui: JSON encode command path along with other elements in MCPcontext modal (#42693)
Closes #42692 Release Notes: - Fixed command path not being correctly encoded in context server config modal
This commit is contained in:
@@ -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()
|
||||
}}"#
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user