pub struct AgentNetworkClient { /* private fields */ }Expand description
MCP relay client that communicates with a subprocess over stdio.
Implementations§
Source§impl AgentNetworkClient
impl AgentNetworkClient
Sourcepub async fn spawn_agent(
&mut self,
description: &str,
working_dir: &str,
config: AgentConfig,
) -> Result<String, AgentNetworkClientError>
pub async fn spawn_agent( &mut self, description: &str, working_dir: &str, config: AgentConfig, ) -> Result<String, AgentNetworkClientError>
Spawn a new agent with the given description and config.
Sourcepub async fn await_agent(
&mut self,
agent_id: &str,
timeout_secs: Option<u64>,
) -> Result<AgentResult, AgentNetworkClientError>
pub async fn await_agent( &mut self, agent_id: &str, timeout_secs: Option<u64>, ) -> Result<AgentResult, AgentNetworkClientError>
Wait for an agent to complete, with optional timeout.
Sourcepub async fn list_agents(
&mut self,
) -> Result<Vec<AgentInfo>, AgentNetworkClientError>
pub async fn list_agents( &mut self, ) -> Result<Vec<AgentInfo>, AgentNetworkClientError>
List all agents.
Sourcepub async fn stop_agent(
&mut self,
agent_id: &str,
) -> Result<(), AgentNetworkClientError>
pub async fn stop_agent( &mut self, agent_id: &str, ) -> Result<(), AgentNetworkClientError>
Stop a running agent by ID.
Sourcepub async fn get_agent_status(
&mut self,
agent_id: &str,
) -> Result<AgentInfo, AgentNetworkClientError>
pub async fn get_agent_status( &mut self, agent_id: &str, ) -> Result<AgentInfo, AgentNetworkClientError>
Get the current status of an agent by ID.
Source§impl AgentNetworkClient
impl AgentNetworkClient
Sourcepub async fn connect(
binary_path: &str,
) -> Result<AgentNetworkClient, AgentNetworkClientError>
pub async fn connect( binary_path: &str, ) -> Result<AgentNetworkClient, AgentNetworkClientError>
Connect to a relay process using default MCP server arguments.
Sourcepub async fn connect_with_args(
binary_path: &str,
args: &[&str],
) -> Result<AgentNetworkClient, AgentNetworkClientError>
pub async fn connect_with_args( binary_path: &str, args: &[&str], ) -> Result<AgentNetworkClient, AgentNetworkClientError>
Connect to a relay process with custom arguments.
Sourcepub async fn send_request(
&mut self,
method: &str,
params: Option<Value>,
) -> Result<Value, AgentNetworkClientError>
pub async fn send_request( &mut self, method: &str, params: Option<Value>, ) -> Result<Value, AgentNetworkClientError>
Send a JSON-RPC request and read the response.
Sourcepub async fn initialize(&mut self) -> Result<Value, AgentNetworkClientError>
pub async fn initialize(&mut self) -> Result<Value, AgentNetworkClientError>
Perform the MCP initialize handshake with the relay process.
Sourcepub async fn call_tool(
&mut self,
name: &str,
args: Value,
) -> Result<Value, AgentNetworkClientError>
pub async fn call_tool( &mut self, name: &str, args: Value, ) -> Result<Value, AgentNetworkClientError>
Call a tool on the relay server by name with the given arguments.
Sourcepub async fn list_tools(&mut self) -> Result<Value, AgentNetworkClientError>
pub async fn list_tools(&mut self) -> Result<Value, AgentNetworkClientError>
List all tools available on the relay server.
Sourcepub async fn shutdown(self) -> Result<(), AgentNetworkClientError>
pub async fn shutdown(self) -> Result<(), AgentNetworkClientError>
Shut down the relay client and terminate the child process.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Check whether the client has completed initialization.
Auto Trait Implementations§
impl !Freeze for AgentNetworkClient
impl !RefUnwindSafe for AgentNetworkClient
impl Send for AgentNetworkClient
impl Sync for AgentNetworkClient
impl Unpin for AgentNetworkClient
impl UnsafeUnpin for AgentNetworkClient
impl !UnwindSafe for AgentNetworkClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more