mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(mcp): switch desc.json loading to fastjson2 to avoid desc.json loading error
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package work.slhaf.partner.core.action.runner.mcp;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.modelcontextprotocol.common.McpTransportContext;
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
@@ -241,7 +241,7 @@ public class DynamicActionMcpManager implements AutoCloseable {
|
||||
}
|
||||
MetaActionInfo info;
|
||||
try {
|
||||
info = JSONUtil.readJSONObject(dir.resolve("desc.json").toFile(), StandardCharsets.UTF_8).toBean(MetaActionInfo.class);
|
||||
info = JSON.parseObject(Files.readString(dir.resolve("desc.json"), StandardCharsets.UTF_8), MetaActionInfo.class);
|
||||
} catch (Exception e) {
|
||||
log.error("desc.json 加载失败: {}", dir);
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package work.slhaf.partner.core.action.runner.mcp;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import io.modelcontextprotocol.common.McpTransportContext;
|
||||
import io.modelcontextprotocol.json.McpJsonMapper;
|
||||
@@ -70,7 +70,7 @@ public class McpMetaRegistry implements AutoCloseable {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
MetaActionInfo info = JSONUtil.readJSONObject(file, StandardCharsets.UTF_8).toBean(MetaActionInfo.class);
|
||||
MetaActionInfo info = JSON.parseObject(Files.readString(file.toPath(), StandardCharsets.UTF_8), MetaActionInfo.class);
|
||||
String uri = file.toPath().toUri().toString();
|
||||
descCache.put(uri, JSONObject.toJSONString(info));
|
||||
String actionKey = name.replace(".desc.json", "");
|
||||
|
||||
Reference in New Issue
Block a user