pub struct Client { /* private fields */ }
Implementations§
Source§impl Client
impl Client
pub fn new() -> Self
pub async fn connect( &mut self, transport: impl ClientTransportTrait, ) -> Result<ProtocolHandle, McpError>
pub async fn initialize( &mut self, client_info: ClientInfo, ) -> Result<InitializeResult, McpError>
pub async fn list_resources( &self, cursor: Option<String>, ) -> Result<ListResourcesResponse, McpError>
pub async fn read_resource( &self, uri: String, ) -> Result<ReadResourceResponse, McpError>
pub async fn subscribe_to_resource(&self, uri: String) -> Result<(), McpError>
pub async fn list_prompts( &self, cursor: Option<String>, ) -> Result<ListPromptsResponse, McpError>
pub async fn get_prompt( &self, name: String, arguments: Option<Value>, ) -> Result<PromptResult, McpError>
pub async fn list_tools( &self, cursor: Option<String>, ) -> Result<ListToolsResponse, McpError>
pub async fn call_tool( &self, name: String, arguments: Value, ) -> Result<ToolResult, McpError>
pub async fn set_log_level(&self, level: String) -> Result<(), McpError>
Sourcepub async fn shutdown(&mut self) -> Result<(), McpError>
pub async fn shutdown(&mut self) -> Result<(), McpError>
Performs graceful shutdown of the client
pub async fn assert_initialized(&self) -> Result<(), McpError>
pub async fn get_server_capabilities(&self) -> Option<ServerCapabilities>
pub async fn has_capability(&self, capability: &str) -> bool
pub async fn get_client_info(&self) -> Option<ClientInfo>
pub async fn has_client_info(&self) -> bool
Sourcepub async fn add_secure_value(&self, key: impl Into<String>, value: SecureValue)
pub async fn add_secure_value(&self, key: impl Into<String>, value: SecureValue)
Add a secure value to the client’s hash map.
Sourcepub async fn get_secure_value(&self, key: &str) -> Result<String, McpError>
pub async fn get_secure_value(&self, key: &str) -> Result<String, McpError>
Retrieve a secure value from the client.
If the stored value is a Static
variant, the stored string is returned.
If the stored value is an Env
variant, the stored string is used as the key
in std::env::var
to retrieve the actual value.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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