adk_mcp_protocol_modern (erlang_adk v0.10.0)

View Source

MCP 2026-07-28 stateless protocol foundations.

The module is transport-independent except for validation and construction of the required Streamable HTTP metadata headers. It does not retain a protocol session and it does not implement the removed GET/SSE or replay mechanisms.

Summary

Functions

Construct a bounded MRTR input_required result. Modern foundations intentionally permit elicitation only; deprecated roots and sampling remain available solely through the legacy capability codec.

Attach responses to an original request for a stateless MRTR retry. The response keys must exactly match the server-issued input request keys.

Construct one self-describing modern JSON-RPC request and its mirrored HTTP headers. ClientContext accepts client_info, client_capabilities, and an optional map of non-reserved metadata.

Validate required modern Streamable HTTP headers against the body. Header names are case-insensitive; header values are case-sensitive.

Functions

cacheable_result(Result0, Options)

-spec cacheable_result(map(), map()) -> {ok, map()} | {error, term()}.

client_capabilities(Capabilities)

-spec client_capabilities(map()) -> {ok, map()} | {error, term()}.

decode_header_value(Value)

-spec decode_header_value(binary()) -> {ok, binary()} | {error, term()}.

discover_result(ServerInfo, Capabilities, Options)

-spec discover_result(map(), map(), map()) -> {ok, map()} | {error, term()}.

encode_header_value(Value)

-spec encode_header_value(binary()) -> {ok, binary()} | {error, term()}.

input_required(InputRequests0, RequestState, ClientCapabilities)

-spec input_required(map(), undefined | binary(), map()) -> {ok, map()} | {error, term()}.

Construct a bounded MRTR input_required result. Modern foundations intentionally permit elicitation only; deprecated roots and sampling remain available solely through the legacy capability codec.

input_response_params(Params0, InputRequests0, InputResponses0, RequestState)

-spec input_response_params(map(), map(), map(), undefined | binary()) -> {ok, map()} | {error, term()}.

Attach responses to an original request for a stateless MRTR retry. The response keys must exactly match the server-issued input request keys.

list_result(Kind, Items0, Options)

-spec list_result(tools | resources | prompts, [map()], map()) -> {ok, map()} | {error, term()}.

request(Id, Method, Params0, ClientContext)

-spec request(binary() | integer(), binary(), map(), map()) ->
                 {ok, #{message := map(), headers := map()}} | {error, term()}.

Construct one self-describing modern JSON-RPC request and its mirrored HTTP headers. ClientContext accepts client_info, client_capabilities, and an optional map of non-reserved metadata.

result_response(Id, Result0, ServerInfo)

-spec result_response(binary() | integer(), map(), map()) -> {ok, map()} | {error, term()}.

server_capabilities(Capabilities)

-spec server_capabilities(map()) -> {ok, map()} | {error, term()}.

subscription_acknowledged(SubscriptionId, Requested0, Granted0)

-spec subscription_acknowledged(binary() | integer(), map(), map()) -> {ok, map()} | {error, term()}.

subscription_complete(SubscriptionId, ServerInfo)

-spec subscription_complete(binary() | integer(), map()) -> {ok, map()} | {error, term()}.

subscription_event(SubscriptionId, Method, Params0)

-spec subscription_event(binary() | integer(), binary(), map()) -> {ok, map()} | {error, term()}.

subscription_listen(Id, Filter0, ClientContext)

-spec subscription_listen(binary() | integer(), map(), map()) ->
                             {ok, #{message := map(), headers := map()}} | {error, term()}.

validate_http_request(Headers0, Message0)

-spec validate_http_request(map() | [{binary(), binary()}], term()) -> {ok, map()} | {error, term()}.

Validate required modern Streamable HTTP headers against the body. Header names are case-insensitive; header values are case-sensitive.

version()

-spec version() -> binary().