AaronOfBarbaria
Adventurer
I agree with the sentiment behind this statement.Overall, I am inclined to allow Shocking Grasp to prevent Uncanny Dodge simply because it makes the spell more interesting. RAF > RAW/RAI at my table.
In fact, it is why I hadn't bothered making any attempt at sorting out which of these two elements has priority over the other (to borrow fighting game terminology) - because my decision on such a ruling will come down to what seems most appropriate at the moment should this entirely unlikely situation come up at my table.
My choice at that time, should it ever come, will likely be along the lines of "Monsters lose ties to PCs" - whichever game element is the one the player is invoking being the one that "wins" their conflict.
I just don't imagine there will be a time when a monster/npc I'm running has Uncanny Dodge, and I'm certain there will not be a time when a monster/npc has spells but has exhausted all of them more useful than cantrips but is still trying to fight rather than flee or negotiate surrender.