Does your MagSafe power adapter have a long power cord with grounded
plug, instead of the simple toggle head plug-in that has no ground prong?
MacBook Pro Important product info:
https://static.bhphotovideo.com/lit_files/96266.pdf
Are the tiny connector pins in each side, the MagSafe adapter and the
MacBook Pro, clean of debris and not dusty or have stuff stuck in them?
These connector pins should be clean. See these support articles:
• Apple Portables: Troubleshooting MagSafe adapters - Apple Support
• About Mac notebook batteries - Apple Support
For all my portable Mac computers, (have four adapters, three computers)
all of mine have and use the long cable to replace the simple toggle head
as this keeps the MagSafe (and older adapter for PowerBook/iBookG4) so
it won't come unplugged from the wall socket. The Cable is recommended.
Although it won't win points for portability; a coiled one does fit in my pack.
• Apple AC Adapter repair guide - iFixit:
https://www.ifixit.com/Device/Apple_AC_Adapter
You may need to set an appointment with an official Apple store genius
to have them inspect the item. You may need to get replacement adapter.
{If they haven't a replacement one in stock -- they are available online...
examples: https://eshop.macsales.com/search/magsafe%20adapter}
There are some references to a metal bodied macbook computers and an
electrical shock; even a few Apple support articles, among search results:
https://duckduckgo.com/?q=magsafe+adapter+power+leaks+to+metal+macbook+pro+causes+shock&ia=web
Anyway, I'd suggest to inspect and have some expert opinion on the issue
plus if the computer has an AppleCare extended plan in effect, it may be
the issue find a resolution if brought to the attention of an Apple genius...
A 'short' may involve an internal problem that may require service tech repair.
Or if only adapter,you should be able to get a replacement MagSafe there.
{For models older than several years, the Apple store may not have them in
stock; so suppliers such as OWC macsales may have one that matches.}
In any event...
Good luck & happy trails! 🙂