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();
|
PropertyList arguments = (*tool_iter)->properties();
|
||||||
|
try {
|
||||||
for (auto& argument : arguments) {
|
for (auto& argument : arguments) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (cJSON_IsObject(tool_arguments)) {
|
if (cJSON_IsObject(tool_arguments)) {
|
||||||
@@ -331,6 +332,11 @@ void McpServer::DoToolCall(int id, const std::string& tool_name, const cJSON* to
|
|||||||
return;
|
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)]() {
|
Application::GetInstance().Schedule([this, id, tool_iter, arguments = std::move(arguments)]() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user