Skip to content

Commit 99abbc7

Browse files
committed
fix: add mcp remove slash commands
1 parent 7954d02 commit 99abbc7

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

src/cortex-tui/src/commands/executor/dispatch.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl CommandExecutor {
9898
"mcp" => self.cmd_mcp(cmd),
9999
"mcp-tools" | "tools" | "lt" => CommandResult::OpenModal(ModalType::McpManager),
100100
"mcp-auth" | "auth" => CommandResult::OpenModal(ModalType::McpManager),
101+
"mcp-remove" | "mcp-rm" => CommandResult::OpenModal(ModalType::McpManager),
101102
"mcp-reload" => CommandResult::OpenModal(ModalType::McpManager),
102103
"mcp-logs" => CommandResult::OpenModal(ModalType::McpManager),
103104

src/cortex-tui/src/commands/executor/tests.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ fn test_async_commands() {
256256
));
257257
}
258258

259+
#[test]
260+
fn test_mcp_remove_commands_open_mcp_manager() {
261+
let executor = CommandExecutor::new();
262+
263+
for command in ["/mcp-remove", "/mcp-rm"] {
264+
assert!(matches!(
265+
executor.execute_str(command),
266+
CommandResult::OpenModal(ModalType::McpManager)
267+
));
268+
}
269+
}
270+
259271
#[test]
260272
fn test_add_command() {
261273
let executor = CommandExecutor::new();

src/cortex-tui/src/commands/registry/builtin.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,15 @@ pub fn register_builtin_commands(registry: &mut CommandRegistry) {
590590
false,
591591
));
592592

593+
registry.register(CommandDef::new(
594+
"mcp-remove",
595+
&["mcp-rm"],
596+
"Remove MCP servers",
597+
"/mcp-remove",
598+
CommandCategory::Mcp,
599+
false,
600+
));
601+
593602
registry.register(CommandDef::new(
594603
"mcp-reload",
595604
&[],

src/cortex-tui/src/commands/registry/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ mod tests {
195195
assert!(registry.exists("mcp"));
196196
assert!(registry.exists("mcp-tools"));
197197
assert!(registry.exists("mcp-auth"));
198+
assert!(registry.exists("mcp-remove"));
199+
assert!(registry.exists("mcp-rm"));
198200
assert!(registry.exists("mcp-reload"));
199201

200202
// Auth

0 commit comments

Comments
 (0)