pub struct DesktopClient { /* private fields */ }
Expand description
Desktop MCP Client
Implementations§
Source§impl DesktopClient
impl DesktopClient
pub fn new(client_config: ClientConfig, desktop_config: DesktopConfig) -> Self
Sourcepub async fn execute_tool_with_history(
&mut self,
tool_name: String,
arguments: HashMap<String, Value>,
) -> Result<McpToolResponse>
pub async fn execute_tool_with_history( &mut self, tool_name: String, arguments: HashMap<String, Value>, ) -> Result<McpToolResponse>
Execute a tool and update history
Sourcepub async fn get_history(&self) -> Vec<HistoryItem>
pub async fn get_history(&self) -> Vec<HistoryItem>
Get execution history
Sourcepub async fn clear_history(&mut self) -> Result<()>
pub async fn clear_history(&mut self) -> Result<()>
Clear execution history
Sourcepub async fn get_state(&self) -> DesktopState
pub async fn get_state(&self) -> DesktopState
Get application state
Sourcepub async fn set_current_tool(
&mut self,
tool_name: Option<String>,
) -> Result<()>
pub async fn set_current_tool( &mut self, tool_name: Option<String>, ) -> Result<()>
Set current tool for the UI
Sourcepub async fn set_tool_argument(
&mut self,
key: String,
value: Value,
) -> Result<()>
pub async fn set_tool_argument( &mut self, key: String, value: Value, ) -> Result<()>
Set tool argument
Sourcepub async fn execute_current_tool(&mut self) -> Result<McpToolResponse>
pub async fn execute_current_tool(&mut self) -> Result<McpToolResponse>
Execute current tool with current arguments
Sourcepub async fn get_available_tools(&self) -> Result<Vec<McpTool>>
pub async fn get_available_tools(&self) -> Result<Vec<McpTool>>
Get available tools
Sourcepub async fn export_history(&self) -> Result<String>
pub async fn export_history(&self) -> Result<String>
Export history to JSON
Sourcepub async fn import_history(&mut self, json_data: &str) -> Result<()>
pub async fn import_history(&mut self, json_data: &str) -> Result<()>
Import history from JSON
Trait Implementations§
Source§impl McpClientBase for DesktopClient
impl McpClientBase for DesktopClient
Source§fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn connect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Connect to MCP server
Source§fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn disconnect<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Disconnect from MCP server
Source§fn get_server_capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_server_capabilities<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ServerCapabilities>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get server capabilities
Source§fn execute_tool<'life0, 'async_trait>(
&'life0 self,
request: McpToolRequest,
) -> Pin<Box<dyn Future<Output = Result<McpToolResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute_tool<'life0, 'async_trait>(
&'life0 self,
request: McpToolRequest,
) -> Pin<Box<dyn Future<Output = Result<McpToolResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute tool on server
Source§fn get_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConnectionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ConnectionStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get connection status
Auto Trait Implementations§
impl Freeze for DesktopClient
impl !RefUnwindSafe for DesktopClient
impl Send for DesktopClient
impl Sync for DesktopClient
impl Unpin for DesktopClient
impl !UnwindSafe for DesktopClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more