Skip to content

Commit d65dcdc

Browse files
committed
fix(lib): update task spawning to use runtime handle for Windows compatibility
1 parent 2e9bad0 commit d65dcdc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/lib.rs

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

794-
// Use the client's runtime to spawn the task
795-
client.runtime.spawn(async move {
794+
// Use the client's runtime handle to spawn the task (Windows compatible)
795+
let handle = client.runtime.handle().clone();
796+
handle.spawn(async move {
796797
let service_guard = service_arc.lock().await;
797798
if let Some(service) = service_guard.as_ref() {
798799
match service.list_tools(None).await {
@@ -878,8 +879,9 @@ pub extern "C" fn mcp_call_tool_init(tool_name: *const c_char, arguments: *const
878879
if let Some(client) = client_opt.as_ref() {
879880
let service_arc = client.service.clone();
880881

881-
// Use the client's runtime to spawn the task
882-
client.runtime.spawn(async move {
882+
// Use the client's runtime handle to spawn the task (Windows compatible)
883+
let handle = client.runtime.handle().clone();
884+
handle.spawn(async move {
883885
let service_guard = service_arc.lock().await;
884886
if let Some(service) = service_guard.as_ref() {
885887
// Parse arguments

0 commit comments

Comments
 (0)