Core MCP (Model Context Protocol) definitions and message handling. Based on specification version 2025-11-25.
Summary
Functions
Creates an error response.
Core MCP methods as defined in the specification.
Returns the best matching protocol version for the given client version.
Returns nil if no compatible version is found.
Creates a notification message.
Creates a success response.
Validates if a message is a valid JSON-RPC 2.0 notification.
Validates if a message is a valid JSON-RPC 2.0 request.
Types
@type error_response() :: %{ jsonrpc: String.t(), id: json_rpc_id(), error: error_object() }
@type method() :: String.t()
@type request() :: %{ jsonrpc: String.t(), id: json_rpc_id(), method: method(), params: map() | nil }
@type response() :: success_response() | error_response()
@type success_response() :: %{jsonrpc: String.t(), id: json_rpc_id(), result: any()}
Functions
Creates an error response.
Core MCP methods as defined in the specification.
Returns the best matching protocol version for the given client version.
Returns nil if no compatible version is found.
Creates a notification message.
Creates a success response.
Validates if a message is a valid JSON-RPC 2.0 notification.
Validates if a message is a valid JSON-RPC 2.0 request.