How Do Protocols Represent Optional Capabilities?
From the earlier reference collection. Read the current software blog.
Capability discovery lets peers advertise supported extensions so each side can choose a defined fallback when a feature is unavailable.
Separate core behavior from extensions
A protocol often needs a stable core that every implementation can use, while some peers support additional features. An optional capability represents one of those extensions. The protocol should describe the capability independently from basic operation and state what a client can expect if the peer supports it. This prevents optional behavior from quietly becoming a requirement for ordinary communication.
Discover support explicitly
Peers can communicate capability support through a documented version declaration, metadata response, feature list, or negotiation exchange. The mechanism varies by protocol, but its meaning should be precise: a positive signal says the peer supports a defined behavior under stated conditions. Silence or an unknown capability should not be interpreted as support unless the protocol explicitly defines that rule.
For example, a client might ask whether a server supports a richer search operation. If the server advertises it, the client can use the extension; otherwise, it can issue a simpler core request or explain that the enhanced result is unavailable. Discovery makes the decision based on peer information rather than guesswork.
Define useful fallback behavior
An optional capability is only interoperable when the unsupported case is considered. The specification should say whether the client can omit the feature, use a less detailed alternative, or must stop because the extension is essential to the requested operation. A fallback should preserve understandable meaning. Silently dropping a security-sensitive option or changing the interpretation of a result can be worse than returning a clear unsupported response.
When a request uses an unsupported extension, the receiver should respond in a way that lets the sender distinguish that case from malformed data or a temporary failure, if the protocol provides such a distinction.
Keep advertisements truthful and testable
Capability claims should correspond to implemented behavior, not merely a planned feature. Tests can cover a supporting peer, a peer that omits the capability, and a peer that receives an unknown extension. They can verify both sides’ fallback choices and ensure the core protocol remains usable. Capability discovery therefore serves as a small contract between peers: it advertises what is available, defines the conditions for using it, and gives clients a sensible path when it is absent.