xdg-mime is a shell script, so you'll get a more manageable trace by asking the shell.
dash -x /usr/bin/xdg-mime
The first complex action after parsing the command line is to detect your desktop environment, using a combination of methods: environment variables, detecting the Gnome session manager through D-Bus, and querying properties of the root window. This is done so that e.g. you get to read PDF files in Evince on Gnome and Okular on KDE.
xdg-mime looks for programs registered as XDG applications in locations that depend on the detected desktop environment.