mirror of
https://github.com/gnh1201/welsonjs.git
synced 2026-04-18 18:18:42 +00:00
Add tools call handling and translate docs
Pass the serializer and request id to ResolveToolsCall and implement a basic dispatcher that extracts params.method. Add a handler stub for "run_jsrt_script" (extracts the script argument; implementation TODO) and log unknown tool methods. Also update McpToolsList.json scriptContract notes from Korean to English to improve readability/localization.
This commit is contained in:
parent
3eea89f5a3
commit
f1456e304c
|
|
@ -83,7 +83,7 @@ namespace WelsonJS.Launcher.ApiEndpoints
|
|||
break;
|
||||
|
||||
case "tools/call":
|
||||
await ResolveToolsCall(ser.ExtractFrom(id, "params", "name"));
|
||||
await ResolveToolsCall(ser, id);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -93,9 +93,24 @@ namespace WelsonJS.Launcher.ApiEndpoints
|
|||
}
|
||||
}
|
||||
|
||||
private async Task ResolveToolsCall(string toolsName)
|
||||
private async Task ResolveToolsCall(JsSerializer ser, int id)
|
||||
{
|
||||
// TODO: ex) get_weather
|
||||
var toolsName = ser.ExtractFrom(id, "params", "method")?.Trim();
|
||||
|
||||
switch (toolsName)
|
||||
{
|
||||
case "run_jsrt_script":
|
||||
{
|
||||
var script = ser.ExtractFrom(id, "params", "arguments", "script")?.Trim();
|
||||
|
||||
// todo
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_logger.Warn($"[JsonRpc2] Unknown tools method: {toolsName}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
"scriptContract": {
|
||||
"requiredEntryPoint": "function main(args) { /* ... */ }; exports.main = main;",
|
||||
"notes": [
|
||||
"모든 실행 스크립트 결과물은 main 함수를 export해야 합니다.",
|
||||
"ES3 문법을 기본으로 작성하고, 필요한 경우 ES5 polyfill 범위 내에서만 확장하세요."
|
||||
"All executable script outputs must export a main function.",
|
||||
"Write using ES3 syntax by default, and extend only within the ES5 polyfill scope if necessary."
|
||||
]
|
||||
},
|
||||
"tools": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user