During the Summit 2019 @vincent-d mentioned the possibility of remotely executing shell commands and @HendrikVE had a working shell-over-bluettoth.
I just wanted to point out to you some work in that direction that may (or may not) be useful. With the PRs I mention below it should be easier to implement something like a CBOR/JSON based interface based on COAP or any other protocol.
The first one is PR #10624 by @MrKevinWeiss which tries to define a common output format for shell commands. In particular, it provides a consistent way of reporting the return code of commands. The tricky part here is that it is still text based.
The other is PR #9538 by me where I define some data structures to express the arguments to a command and also provide a parser. The parser is not important here, but the structures could allow arguments to be parsed from a document (e.g. JSON/CBOR/etc) and introspection by making the commands self-describing.
Hope you can find that useful.