11use std:: {
2+ fmt:: Display ,
23 io:: { self , ErrorKind } ,
34 path:: PathBuf ,
45} ;
@@ -15,6 +16,28 @@ pub enum Template {
1516 Txt ,
1617}
1718
19+ #[ derive( Debug , Clone , ValueEnum , PartialEq ) ]
20+ #[ allow( non_camel_case_types) ]
21+ pub enum LogLevel {
22+ error,
23+ warn,
24+ info,
25+ debug,
26+ trace,
27+ }
28+
29+ impl Display for LogLevel {
30+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
31+ match self {
32+ LogLevel :: error => write ! ( f, "error" ) ,
33+ LogLevel :: warn => write ! ( f, "warn" ) ,
34+ LogLevel :: info => write ! ( f, "info" ) ,
35+ LogLevel :: debug => write ! ( f, "debug" ) ,
36+ LogLevel :: trace => write ! ( f, "trace" ) ,
37+ }
38+ }
39+ }
40+
1841#[ derive( Subcommand , Debug ) ]
1942pub enum DiscoveryCommand {
2043 /// Displays MCP server capability details in the terminal.
@@ -47,6 +70,9 @@ pub struct WriteOptions {
4770 ) ]
4871 pub template_string : Option < String > ,
4972
73+ /// Specifies the logging level for the application (default: info)
74+ #[ arg( long, short) ]
75+ pub log_level : Option < LogLevel > ,
5076 /// Command and arguments to launch the MCP server.
5177 #[ arg(
5278 value_name = "MCP Launch Command" ,
@@ -98,6 +124,10 @@ conflicts_with_all = ["template", "template_string"])]
98124) ]
99125 pub template_string : Option < String > ,
100126
127+ /// Specifies the logging level for the application (default: info)
128+ #[ arg( long, short) ]
129+ pub log_level : Option < LogLevel > ,
130+
101131 /// Command and arguments to launch the MCP server.
102132 #[ arg(
103133 value_name = "MCP Launch Command" ,
@@ -127,6 +157,14 @@ impl DiscoveryCommand {
127157 DiscoveryCommand :: Print ( print_args) => & print_args. mcp_server_cmd ,
128158 }
129159 }
160+
161+ pub fn log_level ( & self ) -> & Option < LogLevel > {
162+ match self {
163+ DiscoveryCommand :: Create ( create_options) => & create_options. log_level ,
164+ DiscoveryCommand :: Update ( update_options) => & update_options. log_level ,
165+ DiscoveryCommand :: Print ( print_args) => & print_args. log_level ,
166+ }
167+ }
130168}
131169
132170#[ derive( Parser , Debug ) ]
@@ -156,6 +194,10 @@ pub struct CommandArguments {
156194 ) ]
157195 pub template_string : Option < String > ,
158196
197+ /// Specifies the logging level for the application (default: info)
198+ #[ arg( long, short) ]
199+ pub log_level : Option < LogLevel > ,
200+
159201 /// Command and arguments to launch the MCP server.
160202 #[ arg(
161203 value_name = "MCP Launch Command" ,
0 commit comments