There is a way to query this (but be prepared for broken implementations that lie about their abilities as well). Quoting ContentDirectory service spec (v3):
2.3.3 SortCapabilities
This state variable is a CSV list of property names that the ContentDirectory service can use to sort Search() or Browse() action results. An empty string indicates that the device does not support any kind of sorting. A wildcard (“*”) indicates that the device supports sorting using all property names supported by the ContentDirectory service. The property names returned MUST include the appropriate namespace prefixes, except for the DIDL-Lite namespace. Properties in the DIDL-Lite namespace MUST always be returned without the prefix. All property names MUST be fully qualified using the double colon (“::”) syntax as defined in Section 2.2.20, “property”. For example, “upnp:foreignMetadata::fmBody::fmURI”