File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -792,6 +792,8 @@ pub extern "C" fn mcp_list_tools_init() -> usize {
792792 // Use spawn_blocking which handles FFI context better on Windows
793793 let runtime_handle_clone = runtime_handle. clone ( ) ;
794794 runtime_handle. spawn_blocking ( move || {
795+ // Enter runtime context BEFORE block_on to set thread-local runtime for tokio::spawn()
796+ let _guard = runtime_handle_clone. enter ( ) ;
795797 runtime_handle_clone. block_on ( async move {
796798 let service_guard = service_arc. lock ( ) . await ;
797799 if let Some ( service) = service_guard. as_ref ( ) {
@@ -880,6 +882,8 @@ pub extern "C" fn mcp_call_tool_init(tool_name: *const c_char, arguments: *const
880882 // Use spawn_blocking which handles FFI context better on Windows
881883 let runtime_handle_clone = runtime_handle. clone ( ) ;
882884 runtime_handle. spawn_blocking ( move || {
885+ // Enter runtime context BEFORE block_on to set thread-local runtime for tokio::spawn()
886+ let _guard = runtime_handle_clone. enter ( ) ;
883887 runtime_handle_clone. block_on ( async move {
884888 let service_guard = service_arc. lock ( ) . await ;
885889 if let Some ( service) = service_guard. as_ref ( ) {
You can’t perform that action at this time.
0 commit comments