# `ExMCP.Protocol.ResultEnvelope`
[🔗](https://github.com/azmaveth/ex_mcp/blob/v1.0.0/lib/ex_mcp/protocol/result_envelope.ex#L1)

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.

# `classification_error`

```elixir
@type classification_error() ::
  :result_must_be_object
  | :missing_result_type
  | {:invalid_result_type, term()}
  | {:unknown_result_type, String.t()}
  | ExMCP.Protocol.CacheableResult.validation_error()
```

# `result_kind`

```elixir
@type result_kind() :: :complete | :input_required | {:extension, String.t()}
```

# `classify`

```elixir
@spec classify(map(), :legacy | :modern | :unknown | String.t() | nil, keyword()) ::
  {:ok, result_kind()} | {:error, classification_error()}
```

Classifies a result without changing its wire representation.

# `validate`

```elixir
@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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
