diff --git a/src/monarch_mcp_custom/server.py b/src/monarch_mcp_custom/server.py index f469392..43022e0 100644 --- a/src/monarch_mcp_custom/server.py +++ b/src/monarch_mcp_custom/server.py @@ -266,8 +266,12 @@ async def api_call(method: str, params: str = "{}") -> str: parsed_params = json.loads(params) if params else {} except json.JSONDecodeError as e: return serialize_json({"error": f"Invalid JSON in params: {e}"}) - result = await method_func(**parsed_params) - return serialize_json(result) + try: + result = await method_func(**parsed_params) + return serialize_json(result) + except Exception as e: + logger.error(f"api_call failed for method={method}: {e}") + return serialize_json({"error": str(e), "method": method}) # --- Health Check Endpoint ---