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