Noizu.MCP.Inspector.Session (Noizu MCP v0.1.3)

Copy Markdown View Source

One inspector session: owns a Noizu.MCP.Client connected to the target server (through Noizu.MCP.Inspector.TapTransport), buffers an event stream for the browser (raw frames, notifications, progress, async call results, pending sampling/elicitation requests), and parks server-initiated requests until a human answers them in the UI.

Fast request/response operations (list/read/get_prompt/...) do not go through this process — the HTTP layer calls Noizu.MCP.Client directly via client/1 so a slow call never delays event fan-out.

Summary

Functions

Block until the session reaches :ready (or error).

Start an async tool call; result arrives as a call_result event.

Cancel an in-flight tool call.

Returns a specification to start this module under a supervisor.

The underlying Noizu.MCP.Client pid (for direct feature calls).

Server info / capabilities / instructions / target descriptor.

Block until the parked sampling/elicitation request map is non-empty or timeout.

Answer a parked sampling/elicitation request.

Options: :id (session id string), :transport{module, opts} inner client transport spec, :descriptor — JSON-safe map describing the target (echoed back for display/config export), :client_info, :roots.

Subscribe the caller to session events ({:inspector_event, event} messages, where event is %{seq: n, event: type, data: map}). Returns events with seq > last_seq for replay. The subscriber is monitored.

Functions

await_ready(session, timeout \\ 15000)

Block until the session reaches :ready (or error).

call_tool(session, name, args)

Start an async tool call; result arrives as a call_result event.

cancel_call(session, call_id)

Cancel an in-flight tool call.

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

client(session)

The underlying Noizu.MCP.Client pid (for direct feature calls).

get_roots(session)

info(session)

Server info / capabilities / instructions / target descriptor.

pending(session)

Block until the parked sampling/elicitation request map is non-empty or timeout.

respond_pending(session, request_id, response)

Answer a parked sampling/elicitation request.

set_roots(session, roots)

start_link(opts)

Options: :id (session id string), :transport{module, opts} inner client transport spec, :descriptor — JSON-safe map describing the target (echoed back for display/config export), :client_info, :roots.

subscribe_events(session, last_seq \\ nil)

Subscribe the caller to session events ({:inspector_event, event} messages, where event is %{seq: n, event: type, data: map}). Returns events with seq > last_seq for replay. The subscriber is monitored.