forked from xiaozhi/xiaozhi-esp32
fix exception
This commit is contained in:
@@ -309,6 +309,7 @@ void McpServer::DoToolCall(int id, const std::string& tool_name, const cJSON* to
|
||||
}
|
||||
|
||||
PropertyList arguments = (*tool_iter)->properties();
|
||||
try {
|
||||
for (auto& argument : arguments) {
|
||||
bool found = false;
|
||||
if (cJSON_IsObject(tool_arguments)) {
|
||||
@@ -331,6 +332,11 @@ void McpServer::DoToolCall(int id, const std::string& tool_name, const cJSON* to
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (const std::runtime_error& e) {
|
||||
ESP_LOGE(TAG, "tools/call: %s", e.what());
|
||||
ReplyError(id, e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
Application::GetInstance().Schedule([this, id, tool_iter, arguments = std::move(arguments)]() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user