mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-04-05 01:31:49 -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",
|
"type": "text",
|
||||||
"text": json.dumps(json_content, indent=2)
|
"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({
|
content.append({
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": api_response.text
|
"text": api_response.text
|
||||||
|
|||||||
Reference in New Issue
Block a user