refactor
重构以加强 abi 的兼容性
This commit is contained in:
1 parent
a7eaa8483f
commit
c0966ad334
5 files changed
+77
-35
No files matched your search
@@ -122,7 +122,9 @@ void mcp_ConfigParser::LoadDllTool(const nlohmann::json &toolConfig, const std::
|
||||
if (pRealTool)
|
||||
{
|
||||
// 给真正的 DLL 实例也注入配置,以防第三方需要在内部读取
|
||||
pRealTool->SetConfig(toolConfig);
|
||||
std::string cfgStr = toolConfig.dump();
|
||||
pRealTool->SetConfigAbiSafe(cfgStr.c_str());
|
||||
//pRealTool->SetConfig(toolConfig);
|
||||
|
||||
// 实例化代理类,接管生命周期
|
||||
auto pProxy = std::make_shared<mcp_Tool_DllProxy>(hMod, pRealTool, destroyFn);
|
||||
@@ -145,7 +147,6 @@ void mcp_ConfigParser::LoadDllTool(const nlohmann::json &toolConfig, const std::
|
||||
|
||||
#pragma endregion mcp_ConfigParser
|
||||
|
||||
|
||||
#pragma region mcp_Tools
|
||||
// 注册工具
|
||||
void mcp_Tools::Register(std::shared_ptr<mcp_Tool> pTool)
|
||||
@@ -177,7 +178,7 @@ nlohmann::json mcp_Tools::Call(const std::string &name, const nlohmann::json &ar
|
||||
}
|
||||
|
||||
// 找不到工具时,返回标准的 JSON-RPC 错误对象
|
||||
return mcp_Tool_Utility::make_error(-32601, "Specified tool not found: " + name);
|
||||
return mcp_Tool_Utility::make_error(-32601, L"Specified tool not found: " + mcp_utils::utf8ToWString(name));
|
||||
}
|
||||
|
||||
void mcp_Tools::print()
|
||||
|
||||
Reference in new issue
Block a user