mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-03-31 07:12:23 -07:00
fix(mcp): Handle non-JSON responses and correct JSON errors
This commit is contained in:
@@ -749,7 +749,8 @@ def _execute_tool(route: Dict[str, Any], args: Dict[str, Any]) -> Dict[str, Any]
|
||||
"type": "text",
|
||||
"text": json.dumps(json_content, indent=2)
|
||||
})
|
||||
except json.JSONDecodeError:
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
# Fallback for endpoints that return plain text instead of JSON (e.g., /metrics)
|
||||
content.append({
|
||||
"type": "text",
|
||||
"text": api_response.text
|
||||
|
||||
Reference in New Issue
Block a user