[PATCH v3 18/35] monitor: use dynamic cast in QMP commands