mchades commented on code in PR #14208:
URL: https://github.com/apache/gravitino/pull/14208#discussion_r4409859536
##########
mcp-server/mcp_server/client/plain/utils.py:
##########
@@ -37,6 +39,31 @@ def extract_content_from_response(response, field: str,
default="") -> str:
return json.dumps(response_json.get(field, default))
+def extract_list_from_response(response, field: str) -> str:
+ """Extract a required JSON array without rounding fractional numbers.
+
+ Propagate server errors and reject malformed envelopes instead of returning
+ an empty result for a failed discovery request.
+ """
+ try:
+ payload = simplejson.loads(response.content, use_decimal=True)
+ except simplejson.JSONDecodeError as exc:
Review Comment:
Fixed in 471a01b954. Invalid UTF-8 now follows the same error handling as
malformed JSON: successful responses raise `GravitinoException` with the
normalized message, while non-2xx responses retain their HTTP status error.
Regression tests cover both metric tools with HTTP 200 and 502.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]