Skip to main content

Server

Trait Server 

Source
pub trait Server: Sync {
Show 15 methods // Required methods fn send( &self, req: SendRequest, ) -> impl Future<Output = Result<SendResponse>> + Send; fn stream( &self, req: StreamRequest, ) -> impl Stream<Item = Result<StreamEvent>> + Send; fn clear_session( &self, req: ClearSessionRequest, ) -> impl Future<Output = Result<SessionCleared>> + Send; fn list_agents(&self) -> impl Future<Output = Result<AgentList>> + Send; fn agent_info( &self, req: AgentInfoRequest, ) -> impl Future<Output = Result<AgentDetail>> + Send; fn list_memory(&self) -> impl Future<Output = Result<MemoryList>> + Send; fn get_memory( &self, req: GetMemoryRequest, ) -> impl Future<Output = Result<MemoryEntry>> + Send; fn download( &self, req: DownloadRequest, ) -> impl Stream<Item = Result<DownloadEvent>> + Send; fn reload_skills( &self, ) -> impl Future<Output = Result<SkillsReloaded>> + Send; fn mcp_add( &self, req: McpAddRequest, ) -> impl Future<Output = Result<McpAdded>> + Send; fn mcp_remove( &self, req: McpRemoveRequest, ) -> impl Future<Output = Result<McpRemoved>> + Send; fn mcp_reload(&self) -> impl Future<Output = Result<McpReloaded>> + Send; fn mcp_list(&self) -> impl Future<Output = Result<McpServerList>> + Send; fn ping(&self) -> impl Future<Output = Result<()>> + Send; // Provided method fn dispatch( &self, msg: ClientMessage, ) -> impl Stream<Item = ServerMessage> + Send + '_ { ... }
}
Expand description

Server-side protocol handler.

Each method corresponds to one ClientMessage variant. Implementations receive typed request structs and return typed responses — no enum matching required. Streaming operations return impl Stream.

The provided dispatch method routes a raw ClientMessage to the appropriate handler, returning a stream of ServerMessages.

Required Methods§

Source

fn send( &self, req: SendRequest, ) -> impl Future<Output = Result<SendResponse>> + Send

Handle Send — run agent and return complete response.

Source

fn stream( &self, req: StreamRequest, ) -> impl Stream<Item = Result<StreamEvent>> + Send

Handle Stream — run agent and stream response events.

Source

fn clear_session( &self, req: ClearSessionRequest, ) -> impl Future<Output = Result<SessionCleared>> + Send

Handle ClearSession — clear agent history.

Source

fn list_agents(&self) -> impl Future<Output = Result<AgentList>> + Send

Handle ListAgents — list all registered agents.

Source

fn agent_info( &self, req: AgentInfoRequest, ) -> impl Future<Output = Result<AgentDetail>> + Send

Handle AgentInfo — get agent details.

Source

fn list_memory(&self) -> impl Future<Output = Result<MemoryList>> + Send

Handle ListMemory — list all memory entries.

Source

fn get_memory( &self, req: GetMemoryRequest, ) -> impl Future<Output = Result<MemoryEntry>> + Send

Handle GetMemory — get a memory entry by key.

Source

fn download( &self, req: DownloadRequest, ) -> impl Stream<Item = Result<DownloadEvent>> + Send

Handle Download — download model files with progress.

Source

fn reload_skills(&self) -> impl Future<Output = Result<SkillsReloaded>> + Send

Handle ReloadSkills — reload skills from disk.

Source

fn mcp_add( &self, req: McpAddRequest, ) -> impl Future<Output = Result<McpAdded>> + Send

Handle McpAdd — add an MCP server.

Source

fn mcp_remove( &self, req: McpRemoveRequest, ) -> impl Future<Output = Result<McpRemoved>> + Send

Handle McpRemove — remove an MCP server.

Source

fn mcp_reload(&self) -> impl Future<Output = Result<McpReloaded>> + Send

Handle McpReload — reload MCP servers from config.

Source

fn mcp_list(&self) -> impl Future<Output = Result<McpServerList>> + Send

Handle McpList — list connected MCP servers.

Source

fn ping(&self) -> impl Future<Output = Result<()>> + Send

Handle Ping — keepalive.

Provided Methods§

Source

fn dispatch( &self, msg: ClientMessage, ) -> impl Stream<Item = ServerMessage> + Send + '_

Dispatch a ClientMessage to the appropriate handler method.

Returns a stream of ServerMessages. Request-response operations yield exactly one message; streaming operations yield many.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§