Classifies result envelopes according to the negotiated MCP protocol era.
Legacy peers may omit resultType; modern and unnegotiated peers may not.
Extension result types are accepted only when the caller explicitly lists
them as negotiated.
Summary
Functions
Classifies a result without changing its wire representation.
Validates a result and returns it unchanged with its classification.
Types
@type classification_error() :: :result_must_be_object | :missing_result_type | {:invalid_result_type, term()} | {:unknown_result_type, String.t()} | ExMCP.Protocol.CacheableResult.validation_error()
@type result_kind() :: :complete | :input_required | {:extension, String.t()}
Functions
@spec classify(map(), :legacy | :modern | :unknown | String.t() | nil, keyword()) :: {:ok, result_kind()} | {:error, classification_error()}
Classifies a result without changing its wire representation.
@spec validate(map(), :legacy | :modern | :unknown | String.t() | nil, keyword()) :: {:ok, result_kind(), map()} | {:error, classification_error()}
Validates a result and returns it unchanged with its classification.