pub struct McpClient { /* private fields */ }Expand description
Client for a single MCP server connection.
Implementations§
Source§impl McpClient
impl McpClient
Sourcepub fn new(config: McpServerConfig) -> Self
pub fn new(config: McpServerConfig) -> Self
Create a new client for the given server configuration.
Sourcepub fn status(&self) -> &McpConnectionStatus
pub fn status(&self) -> &McpConnectionStatus
Get the connection status.
Sourcepub fn resources(&self) -> &[McpResource]
pub fn resources(&self) -> &[McpResource]
Get discovered resources.
Sourcepub async fn connect(&mut self) -> Result<(), String>
pub async fn connect(&mut self) -> Result<(), String>
Connect to the MCP server and perform initialization.
Sourcepub async fn call_tool(
&self,
tool_name: &str,
arguments: Value,
) -> Result<McpToolResult, String>
pub async fn call_tool( &self, tool_name: &str, arguments: Value, ) -> Result<McpToolResult, String>
Call a tool on the MCP server.
Sourcepub async fn read_resource(&self, uri: &str) -> Result<String, String>
pub async fn read_resource(&self, uri: &str) -> Result<String, String>
Read a resource from the MCP server.
Sourcepub async fn disconnect(&mut self)
pub async fn disconnect(&mut self)
Disconnect from the MCP server.
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