pub struct McpClient {
pub name: String,
/* private fields */
}Expand description
MCP client for communicating with MCP servers
Fields§
§name: StringServer name
Implementations§
Source§impl McpClient
impl McpClient
Sourcepub fn new(name: String, transport: Arc<dyn McpTransport>) -> Self
pub fn new(name: String, transport: Arc<dyn McpTransport>) -> Self
Create a new MCP client with the given transport
Sourcepub async fn initialize(&self) -> Result<InitializeResult>
pub async fn initialize(&self) -> Result<InitializeResult>
Initialize the MCP connection
Sourcepub async fn is_initialized(&self) -> bool
pub async fn is_initialized(&self) -> bool
Check if client is initialized
Sourcepub async fn capabilities(&self) -> ServerCapabilities
pub async fn capabilities(&self) -> ServerCapabilities
Get server capabilities
Sourcepub async fn list_tools(&self) -> Result<Vec<McpTool>>
pub async fn list_tools(&self) -> Result<Vec<McpTool>>
List available tools
Sourcepub async fn get_cached_tools(&self) -> Vec<McpTool>
pub async fn get_cached_tools(&self) -> Vec<McpTool>
Get cached tools
Sourcepub async fn call_tool(
&self,
name: &str,
arguments: Option<Value>,
) -> Result<CallToolResult>
pub async fn call_tool( &self, name: &str, arguments: Option<Value>, ) -> Result<CallToolResult>
Call a tool
Sourcepub async fn list_resources(&self) -> Result<Vec<McpResource>>
pub async fn list_resources(&self) -> Result<Vec<McpResource>>
List available resources
Sourcepub async fn read_resource(&self, uri: &str) -> Result<ReadResourceResult>
pub async fn read_resource(&self, uri: &str) -> Result<ReadResourceResult>
Read a resource
Sourcepub fn notifications(&self) -> Receiver<McpNotification>
pub fn notifications(&self) -> Receiver<McpNotification>
Get notification receiver
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected
Auto Trait Implementations§
impl !Freeze for McpClient
impl !RefUnwindSafe for McpClient
impl Send for McpClient
impl Sync for McpClient
impl Unpin for McpClient
impl UnsafeUnpin for McpClient
impl !UnwindSafe for McpClient
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