adk_mcp_pool (erlang_adk v0.10.0)

View Source

Bounded FIFO connection pool for MCP clients.

Connections are leased to one borrower at a time. Borrower death and explicit cancellation always discard the connection because an in-flight request may have reached the peer. The pool reconnects for future leases; request/4 never replays a callback, and reports mutating disconnects as an uncertain delivery instead of risking duplicate effects.

Summary

Functions

cancel(Pool, Lease)

-spec cancel(pid(), reference()) -> ok | {error, term()}.

checkin(Pool, Lease, Outcome)

-spec checkin(pid(), reference(), healthy | disconnected | failed) -> ok | {error, term()}.

checkout(Pool, Timeout)

-spec checkout(pid(), pos_integer()) -> {ok, reference(), term()} | {error, term()}.

child_spec(Config)

-spec child_spec(map()) -> supervisor:child_spec().

code_change(OldVersion, State, Extra)

format_status(Status)

handle_call(Request, From, State0)

handle_cast(Message, State)

handle_info(Message, State0)

init(Config0)

request(Pool, Class, Fun, Timeout)

-spec request(pid(), read_only | mutation, fun((term()) -> term()), pos_integer()) -> term().

start(Config)

-spec start(map()) -> gen_server:start_ret().

start_link(Config)

-spec start_link(map()) -> gen_server:start_ret().

status(Pool)

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

stop(Pool)

-spec stop(pid()) -> ok.

terminate(Reason, State)