Condukt.MCP.Registry (Condukt v1.4.1)

Copy Markdown View Source

Lifecycle helper for connecting to a list of MCP servers as part of starting a session or executing a workflow.

start_all/2 opens one Condukt.MCP.Client per server and discovers the tools each one exposes. The returned registry value carries the client pids and prebuilt Condukt.Tool.Inline specs ready to merge into an agent or workflow tool list.

stop_all/1 closes every connection in the registry. Tool inline specs returned by tools/1 capture the client pid in their :call closure, so once stopped they will fail with a transport error.

Summary

Functions

Returns the entries in the registry. Useful for telemetry or introspection.

Returns an empty registry.

Starts a Condukt.MCP.Client for each server in servers.

Stops every connection in the registry. Safe to call when the registry is already empty or when individual clients have already exited.

Returns a tool_id => inline_spec map suitable for the workflow tool registry's :tools extension option.

Returns every inline tool spec exposed by the registry, flattened into a single list ready to be appended to an agent's tools list.

Functions

entries(registry)

Returns the entries in the registry. Useful for telemetry or introspection.

new()

Returns an empty registry.

start_all(servers, opts \\ [])

Starts a Condukt.MCP.Client for each server in servers.

Servers may be %Condukt.MCP.Server{} structs or plain maps that Condukt.MCP.Server.normalize/1 can normalize. On the first failure every already-started client is stopped before returning the error.

Options are forwarded to Condukt.MCP.Client.start_link/2 (and ultimately to the transports). Use :fetch_env, :token_request, :sse_request, and :http_request to inject test doubles.

stop_all(other)

Stops every connection in the registry. Safe to call when the registry is already empty or when individual clients have already exited.

tool_map(registry)

Returns a tool_id => inline_spec map suitable for the workflow tool registry's :tools extension option.

tools(registry)

Returns every inline tool spec exposed by the registry, flattened into a single list ready to be appended to an agent's tools list.