class

Smith::MCP::ServerHandle

Inherits Reference < Object

The lifecycle of one server: start it, keep it, restart it once if it dies, then give up on it.

The give-up is deliberate. A server that crashes twice is broken, and retrying it on every call would turn every turn into a restart loop — slower than having no tool at all, and far harder to read from a transcript.

Constructors

new(spec : ServerSpec, name : String, timeout : Time::Span = Client::DEFAULT_TIMEOUT, startup_timeout : Time::Span = Client::STARTUP_TIMEOUT)
Source

Instance methods

call(tool : String, arguments : JSON::Any) : ToolResult
Source
error
Source
lost?
Source
name

The sanitised server name, as it appears in mcp__<server>__<tool>.

Source
on_lost

Wired by whoever registered the tools, so they can be withdrawn when the server is given up on. The manager knows the registry; this file does not.

Source
on_lost=(on_lost : Proc(ServerHandle, Nil) | Nil)

Wired by whoever registered the tools, so they can be withdrawn when the server is given up on. The manager knows the registry; this file does not.

Source
running?
Source
spec
Source
start

False rather than raising: one server that will not start must never take the session with it.

Source
stderr_tail

The server's own stderr, kept so a failed handshake can say what the process actually complained about.

Source
stop
Source
tools
Source