class LittleGhost::MCP::Toolset

Loads remote Tool classes through an application-created official MCP::Client. The client factory runs during Tool discovery with the current Tool::Binding. It must return a fresh, unconnected client without starting remote work. After the factory returns, LittleGhost connects the client, shares it among the generated Tool instances, and calls close on its transport, when supported, as the owning run or ToolRegistry closes.

Discovery and Tool calls carry the run’s cancellation and deadline into the SDK. The official SDK executes cancellable requests on worker threads. Calls through the official HTTP transport may overlap. When the official stdio transport is supplied directly, calls are serialized and cancelling one invalidates that run’s session. Custom or decorated transports own their serialization, cancellation-safe invalidation, and cleanup. SDK handlers may run on worker or listener threads, so application callbacks must support concurrent use and must not depend on the calling fiber’s local state. Treat handler requests as untrusted and authorize any local work or data they can reach.

class HelpCenterTools < LittleGhost::MCP::Toolset
  client do |_binding|
    transport = MCP::Client::HTTP.new(url: "https://mcp.example/rpc")
    MCP::Client.new(transport:)
  end
end