There are some digital pins (some of which support PWM), some analogue input pins, some serial ports etc. Firmata holds this information in a header file (Boards.h), the IDE does the same (pins_arduino.h). You tell the IDE which Arduino you have, it knows what to do, and you can get the information in your sketch.
Firmata doesn't work all that well on a Mega. It knows about the pins that do certain things only because you call the functions with the specific pin to use. It doesn't know that a Mega has more pins, or that certain of those pins are specific purpose.
If you want, in your PC application, to read from pin 47 on a UNO, Firmata will happily accept that command, and return crap because it can't actually read pin 47.
If you want, in your PC application, to PWM pin 18, Firmata is happy to apply that command. Nothing will happen, but Firmata won't scold you for it.
If you are writing an application on a PC to talk to an Arduino, I assume, and Firmata does to, that you can look at the Arduino, count the pins, and pay attention to whether a specific pin exists and has the capabilities to perform the task that you are setting for that pin.
Making the Arduino call you a doofus if you pass it an invalid pin number, or try to perform PWM on a non-PWM pin, or try to analog read a digital pin is all possible. But, Firmata doesn't, and I don't think that it is part of the protocol to perform that checking.
After all, the definition of protocol does not include error checking. A protocol simply defines a set of commands that both sides understand. Part of that understanding is knowing when to use each command.
It's for those people that are prepared to put up with it's limitations, and don't want to learn some fairly simple coding.
Exactly. It isn't rocket surgery to replace Firmata with a protocol that works. That it is not universal, or means little to anyone else, is not a reason for not defining your own for your use.
If you want to publish a protocol, and support it, you (or I) are free to do so. If you do, I would expect you to support it. The biggest problem with Firmata, in my opinion, is that it is not supported.
It is delivered with the Arduino IDE but there is no active support for it that I have seen.