adk_mcp_client (erlang_adk v0.7.0)

View Source

Bounded MCP 2025-11-25 client for stdio and Streamable HTTP.

Each connection is an independent OTP worker. When erlang_adk is running, workers are temporary children of adk_mcp_client_sup; callers are never linked to remote MCP process failures.

Summary

Functions

Build an adk_tool_executor-compatible call. Invocation context is not forwarded to the remote server, preventing scoped state or credential references from becoming MCP arguments accidentally.

Return MCP tools in the provider-facing adk_tool schema shape. This callback follows adk_toolset's list contract; discovery failure raises a bounded error which adk_toolset converts to toolset_unavailable rather than silently creating an agent with no remote tools.

Types

options/0

-type options() :: map().

Functions

close(Client)

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

code_change(OldVersion, State, Extra)

connect(Transport, Target)

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

connect(Transport, Target, Options)

-spec connect(binary(), binary(), options()) -> {ok, pid()} | {error, term()}.

execute_tool(Client, ToolName, Args)

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

format_status(Status)

get_prompt(Client, Name, Arguments)

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

handle_call(Request, From, State)

handle_cast(Message, State)

handle_info(Info, State)

init(_)

list_prompts(Client)

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

list_prompts(Client, Cursor)

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

list_resources(Client)

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

list_resources(Client, Cursor)

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

list_tools(Client)

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

list_tools(Client, Cursor)

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

read_resource(Client, Uri)

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

resolved_call(Client, Name, Args, Context)

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

Build an adk_tool_executor-compatible call. Invocation context is not forwarded to the remote server, preventing scoped state or credential references from becoming MCP arguments accidentally.

schemas(Client)

-spec schemas(pid()) -> [map()].

Return MCP tools in the provider-facing adk_tool schema shape. This callback follows adk_toolset's list contract; discovery failure raises a bounded error which adk_toolset converts to toolset_unavailable rather than silently creating an agent with no remote tools.

server_info(Client)

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

start_link(Init)

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

terminate(Reason, State)