From d7f58a9b0ce7d8de745b7e151f9965f08377e7df Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Sat, 7 Mar 2026 14:44:14 +0900 Subject: [PATCH] Propagate request id and add tools call handler Forward the JSON-RPC request id through the dispatcher and handler so methods can access the id. JsonRpc2Dispatcher now passes the id to dispatchMethodAsync, and the JsonRpc2 endpoint lambda accepts the id parameter. Implemented a call for "tools/call" that extracts the tool name via ser.ExtractFrom(id, "params", "name") and invokes a new ResolveToolsCall(string) stub (TODO: implement actual tool logic). This prepares the codepath for tooling invocation based on request params. --- .../WelsonJS.Launcher/ApiEndpoints/JsonRpc2.cs | 9 +++++++-- .../WelsonJS.Launcher/JsonRpc2Dispatcher.cs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/WelsonJS.Augmented/WelsonJS.Launcher/ApiEndpoints/JsonRpc2.cs b/WelsonJS.Augmented/WelsonJS.Launcher/ApiEndpoints/JsonRpc2.cs index 5964ee5..05aded7 100644 --- a/WelsonJS.Augmented/WelsonJS.Launcher/ApiEndpoints/JsonRpc2.cs +++ b/WelsonJS.Augmented/WelsonJS.Launcher/ApiEndpoints/JsonRpc2.cs @@ -74,7 +74,7 @@ namespace WelsonJS.Launcher.ApiEndpoints { await dispatcher.HandleAsync( body, - async (method, ser, ct) => + async (method, id, ser, ct) => { switch (method) { @@ -83,7 +83,7 @@ namespace WelsonJS.Launcher.ApiEndpoints break; case "tools/call": - // TODO: implement tool calling + await ResolveToolsCall(ser.ExtractFrom(id, "params", "name")); break; } @@ -92,5 +92,10 @@ namespace WelsonJS.Launcher.ApiEndpoints cts.Token); } } + + private async Task ResolveToolsCall(string toolsName) + { + // TODO: ex) get_weather + } } } diff --git a/WelsonJS.Augmented/WelsonJS.Launcher/JsonRpc2Dispatcher.cs b/WelsonJS.Augmented/WelsonJS.Launcher/JsonRpc2Dispatcher.cs index 4f5695b..18341f3 100644 --- a/WelsonJS.Augmented/WelsonJS.Launcher/JsonRpc2Dispatcher.cs +++ b/WelsonJS.Augmented/WelsonJS.Launcher/JsonRpc2Dispatcher.cs @@ -62,7 +62,7 @@ namespace WelsonJS.Launcher Method = method }; - return await dispatchMethodAsync(req.Method, ser, ct); + return await dispatchMethodAsync(req.Method, id, ser, ct); } catch (JsonRpc2Exception) {