pub struct McpClient { /* private fields */ }Expand description
MCP client wrapper.
Implementations§
Source§impl McpClient
impl McpClient
Sourcepub fn new(transport: McpTransport) -> Self
pub fn new(transport: McpTransport) -> Self
Create a new MCP client.
Sourcepub fn builder() -> McpClientBuilder
pub fn builder() -> McpClientBuilder
Create a client builder.
Sourcepub async fn disconnect(&mut self) -> Result<()>
pub async fn disconnect(&mut self) -> Result<()>
Disconnect from the MCP server.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if connected.
Sourcepub async fn list_tools(&mut self) -> Result<Vec<ToolDefinition>>
pub async fn list_tools(&mut self) -> Result<Vec<ToolDefinition>>
List available tools.
Sourcepub async fn get_tool(&mut self, name: &str) -> Result<Option<ToolDefinition>>
pub async fn get_tool(&mut self, name: &str) -> Result<Option<ToolDefinition>>
Get a specific tool definition.
Sourcepub async fn call_tool(
&self,
name: &str,
arguments: Value,
) -> Result<ToolResult>
pub async fn call_tool( &self, name: &str, arguments: Value, ) -> Result<ToolResult>
Execute a tool call.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
Get the session ID.
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear the tool cache.
Auto Trait Implementations§
impl Freeze for McpClient
impl !RefUnwindSafe for McpClient
impl Send for McpClient
impl Sync for McpClient
impl Unpin for McpClient
impl !UnwindSafe for McpClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request