Strict JSON-RPC 2.0 decoding and encoding for MCP wire messages.
Summary
Functions
Recovers a valid JSON-RPC ID from an otherwise invalid JSON object.
Types
@type extensions() :: json_object()
@type json_object() :: %{optional(String.t()) => json_value()}
@type json_value() :: nil | boolean() | number() | String.t() | [json_value()] | json_object()
@type notification() :: %{ :kind => :notification, :method => String.t(), :params => map(), optional(:extensions) => extensions() }
@type request() :: %{ :kind => :request, :id => id(), :method => String.t(), :params => map(), optional(:extensions) => extensions() }
@type response() :: %{ :kind => :response, :id => id(), :result => json_value(), :error => map() | nil, optional(:extensions) => extensions() }
Functions
@spec decode( binary(), keyword() ) :: {:ok, request() | notification() | response()} | {:error, AttestoMCP.Server.Error.t()}
Recovers a valid JSON-RPC ID from an otherwise invalid JSON object.