There should be a tool to create such actions in Caja (default file manager in Mate desktop environment), installed with
sudo apt install caja-actions
But it doesn't seem to work, as indicated here.
In my case, this tool is in the start menu, but it doesn't launch (Mint Mate 18.3, based on Ubuntu 16.04).
How to create such actions manually?
This is posted in order to provide an answer.