Skip to content

Commit ec98574

Browse files
committed
fix(lib): spawn tasks directly on the runtime for Windows compatibility
1 parent 8a066c3 commit ec98574

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/lib.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,8 @@ pub extern "C" fn mcp_list_tools_init() -> usize {
788788
// Clone the Arc to share the service across async boundaries
789789
let service_arc = client.service.clone();
790790

791-
// Use the client's runtime handle to spawn the task (Windows compatible)
792-
let handle = client.runtime.handle().clone();
793-
handle.spawn(async move {
791+
// Spawn directly on the runtime (Windows compatible)
792+
client.runtime.spawn(async move {
794793
let service_guard = service_arc.lock().await;
795794
if let Some(service) = service_guard.as_ref() {
796795
match service.list_tools(None).await {
@@ -873,9 +872,8 @@ pub extern "C" fn mcp_call_tool_init(tool_name: *const c_char, arguments: *const
873872
if let Some(client) = client_opt.as_ref() {
874873
let service_arc = client.service.clone();
875874

876-
// Use the client's runtime handle to spawn the task (Windows compatible)
877-
let handle = client.runtime.handle().clone();
878-
handle.spawn(async move {
875+
// Spawn directly on the runtime (Windows compatible)
876+
client.runtime.spawn(async move {
879877
let service_guard = service_arc.lock().await;
880878
if let Some(service) = service_guard.as_ref() {
881879
// Parse arguments

0 commit comments

Comments
 (0)