@@ -13,14 +13,6 @@ use eyre::{
13
13
} ;
14
14
use tracing:: warn;
15
15
16
- use crate :: cli:: chat:: cli:: {
17
- Mcp ,
18
- McpAdd ,
19
- McpImport ,
20
- McpList ,
21
- McpRemove ,
22
- Scope ,
23
- } ;
24
16
use crate :: cli:: chat:: tool_manager:: {
25
17
McpServerConfig ,
26
18
global_mcp_config_path,
@@ -31,18 +23,26 @@ use crate::cli::chat::tools::custom_tool::{
31
23
default_timeout,
32
24
} ;
33
25
use crate :: cli:: chat:: util:: shared_writer:: SharedWriter ;
26
+ use crate :: cli:: chat:: {
27
+ McpAdd ,
28
+ McpImport ,
29
+ McpList ,
30
+ McpRemove ,
31
+ McpSubcommand ,
32
+ Scope ,
33
+ } ;
34
34
use crate :: platform:: Context ;
35
35
36
- pub async fn execute_mcp ( args : Mcp ) -> Result < ExitCode > {
36
+ pub async fn execute_mcp ( subcommand : McpSubcommand ) -> Result < ExitCode > {
37
37
let ctx = Context :: new ( ) ;
38
38
let mut output = SharedWriter :: stdout ( ) ;
39
39
40
- match args {
41
- Mcp :: Add ( args) => add_mcp_server ( & ctx, & mut output, args) . await ?,
42
- Mcp :: Remove ( args) => remove_mcp_server ( & ctx, & mut output, args) . await ?,
43
- Mcp :: List ( args) => list_mcp_server ( & ctx, & mut output, args) . await ?,
44
- Mcp :: Import ( args) => import_mcp_server ( & ctx, & mut output, args) . await ?,
45
- Mcp :: Status { name } => get_mcp_server_status ( & ctx, & mut output, name) . await ?,
40
+ match subcommand {
41
+ McpSubcommand :: Add ( args) => add_mcp_server ( & ctx, & mut output, args) . await ?,
42
+ McpSubcommand :: Remove ( args) => remove_mcp_server ( & ctx, & mut output, args) . await ?,
43
+ McpSubcommand :: List ( args) => list_mcp_server ( & ctx, & mut output, args) . await ?,
44
+ McpSubcommand :: Import ( args) => import_mcp_server ( & ctx, & mut output, args) . await ?,
45
+ McpSubcommand :: Status { name } => get_mcp_server_status ( & ctx, & mut output, name) . await ?,
46
46
}
47
47
48
48
output. flush ( ) ?;
@@ -324,7 +324,7 @@ mod tests {
324
324
325
325
#[ tokio:: test]
326
326
async fn add_then_remove_cycle ( ) {
327
- use crate :: cli:: chat:: cli :: {
327
+ use crate :: cli:: chat:: {
328
328
McpAdd ,
329
329
McpRemove ,
330
330
} ;
0 commit comments