Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/json/json_serialization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ jsonrpc::ResponseResult deserialize_ResponseResult(const JsonValue& json) {
} else if (json.isString()) {
return jsonrpc::ResponseResult(json.getString());
} else if (json.isObject()) {
// Check if it's a specific type based on "type" field
// Check if it's a specific type based on fields present
if (json.contains("type")) {
std::string type = json["type"].getString();
if (type == "text" || type == "image" || type == "resource") {
Expand All @@ -524,6 +524,10 @@ jsonrpc::ResponseResult deserialize_ResponseResult(const JsonValue& json) {
return jsonrpc::ResponseResult(blocks);
}
}
// Check if it's a ListResourcesResult - has "resources" array field
if (json.contains("resources") && json["resources"].isArray()) {
return jsonrpc::ResponseResult(from_json<ListResourcesResult>(json));
}
// Otherwise treat as Metadata
return jsonrpc::ResponseResult(jsonToMetadata(json));
} else if (json.isArray() && json.size() > 0) {
Expand Down