The delivery of the divine message to halt the plague and establish an altar happens through a deliberate chain of messengers. The angel involved in this process is actually the very same destroying angel who carried out the plague [מלבי״ם]. Once he ceases his destruction, he transforms into a channel of prophecy. In doing so, the angel himself prepares the cure for the very blow he just inflicted.
The angel communicates this instruction to Gad through a prophetic vision, and Gad is then tasked with bringing it to David. The message is routed through Gad for a specific reason. While David had the ability to pray to God without any intermediaries, he did not possess the spiritual strength required at that time to receive a direct prophetic word from Him [ביאור שטיינזלץ].
The core of this relayed message is a clear command. David is explicitly instructed to go up to the threshing floor to build an altar there [מצודת דוד].