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§
Sourcefn send(
&self,
req: SendRequest,
) -> impl Future<Output = Result<SendResponse>> + Send
fn send( &self, req: SendRequest, ) -> impl Future<Output = Result<SendResponse>> + Send
Handle Send — run agent and return complete response.
Sourcefn stream(
&self,
req: StreamRequest,
) -> impl Stream<Item = Result<StreamEvent>> + Send
fn stream( &self, req: StreamRequest, ) -> impl Stream<Item = Result<StreamEvent>> + Send
Handle Stream — run agent and stream response events.
Sourcefn clear_session(
&self,
req: ClearSessionRequest,
) -> impl Future<Output = Result<SessionCleared>> + Send
fn clear_session( &self, req: ClearSessionRequest, ) -> impl Future<Output = Result<SessionCleared>> + Send
Handle ClearSession — clear agent history.
Sourcefn list_agents(&self) -> impl Future<Output = Result<AgentList>> + Send
fn list_agents(&self) -> impl Future<Output = Result<AgentList>> + Send
Handle ListAgents — list all registered agents.
Sourcefn agent_info(
&self,
req: AgentInfoRequest,
) -> impl Future<Output = Result<AgentDetail>> + Send
fn agent_info( &self, req: AgentInfoRequest, ) -> impl Future<Output = Result<AgentDetail>> + Send
Handle AgentInfo — get agent details.
Sourcefn list_memory(&self) -> impl Future<Output = Result<MemoryList>> + Send
fn list_memory(&self) -> impl Future<Output = Result<MemoryList>> + Send
Handle ListMemory — list all memory entries.
Sourcefn get_memory(
&self,
req: GetMemoryRequest,
) -> impl Future<Output = Result<MemoryEntry>> + Send
fn get_memory( &self, req: GetMemoryRequest, ) -> impl Future<Output = Result<MemoryEntry>> + Send
Handle GetMemory — get a memory entry by key.
Sourcefn download(
&self,
req: DownloadRequest,
) -> impl Stream<Item = Result<DownloadEvent>> + Send
fn download( &self, req: DownloadRequest, ) -> impl Stream<Item = Result<DownloadEvent>> + Send
Handle Download — download model files with progress.
Sourcefn reload_skills(&self) -> impl Future<Output = Result<SkillsReloaded>> + Send
fn reload_skills(&self) -> impl Future<Output = Result<SkillsReloaded>> + Send
Handle ReloadSkills — reload skills from disk.
Sourcefn mcp_add(
&self,
req: McpAddRequest,
) -> impl Future<Output = Result<McpAdded>> + Send
fn mcp_add( &self, req: McpAddRequest, ) -> impl Future<Output = Result<McpAdded>> + Send
Handle McpAdd — add an MCP server.
Sourcefn mcp_remove(
&self,
req: McpRemoveRequest,
) -> impl Future<Output = Result<McpRemoved>> + Send
fn mcp_remove( &self, req: McpRemoveRequest, ) -> impl Future<Output = Result<McpRemoved>> + Send
Handle McpRemove — remove an MCP server.
Sourcefn mcp_reload(&self) -> impl Future<Output = Result<McpReloaded>> + Send
fn mcp_reload(&self) -> impl Future<Output = Result<McpReloaded>> + Send
Handle McpReload — reload MCP servers from config.
Provided Methods§
Sourcefn dispatch(
&self,
msg: ClientMessage,
) -> impl Stream<Item = ServerMessage> + Send + '_
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.