@@ -1116,7 +1116,8 @@ fn generate_snippet(args: McpSnippetArgs) -> Result<()> {
11161116 // For run_command with script_file, read the file content and inline it
11171117 if args. tool == "run_command" {
11181118 // Clone the script_file value to avoid borrow issues
1119- let script_file_opt = args_value. get ( "script_file" )
1119+ let script_file_opt = args_value
1120+ . get ( "script_file" )
11201121 . and_then ( |v| v. as_str ( ) )
11211122 . filter ( |s| !s. is_empty ( ) )
11221123 . map ( |s| s. to_string ( ) ) ;
@@ -1137,20 +1138,31 @@ fn generate_snippet(args: McpSnippetArgs) -> Result<()> {
11371138
11381139 // Read the script file content
11391140 if script_path. exists ( ) {
1140- let content = std:: fs:: read_to_string ( & script_path)
1141- . with_context ( || format ! ( "Failed to read script file: {}" , script_path. display( ) ) ) ?;
1141+ let content = std:: fs:: read_to_string ( & script_path) . with_context ( || {
1142+ format ! ( "Failed to read script file: {}" , script_path. display( ) )
1143+ } ) ?;
11421144 let content_len = content. len ( ) ;
11431145
11441146 // Replace script_file with run containing the file content
11451147 if let Some ( obj) = args_value. as_object_mut ( ) {
11461148 obj. remove ( "script_file" ) ;
11471149 obj. insert ( "run" . to_string ( ) , serde_json:: Value :: String ( content) ) ;
11481150 // Add a marker so the snippet generator knows this was inlined
1149- obj. insert ( "_inlined_from" . to_string ( ) , serde_json:: Value :: String ( script_file. clone ( ) ) ) ;
1151+ obj. insert (
1152+ "_inlined_from" . to_string ( ) ,
1153+ serde_json:: Value :: String ( script_file. clone ( ) ) ,
1154+ ) ;
11501155 }
1151- eprintln ! ( "[snippet] Inlined script_file: {} ({} bytes)" , script_file, content_len) ;
1156+ eprintln ! (
1157+ "[snippet] Inlined script_file: {} ({} bytes)" ,
1158+ script_file, content_len
1159+ ) ;
11521160 } else {
1153- eprintln ! ( "[snippet] Warning: script_file not found: {} (tried: {})" , script_file, script_path. display( ) ) ;
1161+ eprintln ! (
1162+ "[snippet] Warning: script_file not found: {} (tried: {})" ,
1163+ script_file,
1164+ script_path. display( )
1165+ ) ;
11541166 }
11551167 }
11561168 }
0 commit comments