Windows defragmenter doesn't see MyCloud drives either.
I think that you would have to connect it directly to a computer rather than the router.
But there again aren't they Unix/Linux which shouldn't need defragging?
https://www.howtogeek.com/115229/htg-explains-why-linux-doesnt-need-defragmenting/
Do Western Digital have a defragging app for them ?
Doesn't the NAS utilities for the brand of NAS you bought have something for that such as an app in their console software? I personally wouldn't use a 3rd party tool to do it, especially if it isn't explicitly supported by the NAS you use.