Behaviour for root-owned upstream client transports.
Transports return PtcRunner.Upstream.Result tuples and normalize any
protocol-specific envelopes before values reach tool/call.
Summary
Functions
Start a transport GenServer with :trap_exit temporarily enabled in the
caller, so a child that fails during init/1 surfaces as {:error, reason}
instead of crashing the (often unsupervised) caller. The caller's original
:trap_exit flag is restored afterward.
Types
@type call_opts() :: [timeout: pos_integer(), max_response_bytes: pos_integer()]
@type server_name() :: String.t()
@type tool_name() :: String.t()
@type tool_schema() :: map()
@type upstream() :: map()
Callbacks
@callback call(upstream(), tool_name(), args :: map(), call_opts()) :: PtcRunner.Upstream.Result.t()
@callback list_tools(upstream()) :: {:ok, [tool_schema()]} | {:error, PtcRunner.Upstream.Result.reason(), String.t()}
Functions
@spec start_trapped(module(), server_name(), map()) :: GenServer.on_start()
Start a transport GenServer with :trap_exit temporarily enabled in the
caller, so a child that fails during init/1 surfaces as {:error, reason}
instead of crashing the (often unsupervised) caller. The caller's original
:trap_exit flag is restored afterward.
Shared by the stateful MCP transports (McpHttp, McpStdio).