pub struct Client { /* private fields */ }
Expand description
MCP client
Implementations§
Source§impl Client
impl Client
Sourcepub async fn initialize(&self) -> Result<InitializeResult>
pub async fn initialize(&self) -> Result<InitializeResult>
Initialize the client
Sourcepub async fn list_tools(&self) -> Result<ToolsListResult>
pub async fn list_tools(&self) -> Result<ToolsListResult>
List available tools
Sourcepub async fn list_resource_templates(
&self,
) -> Result<ResourceTemplatesListResult>
pub async fn list_resource_templates( &self, ) -> Result<ResourceTemplatesListResult>
List available resource templates
Sourcepub async fn complete(
&self,
request: CompleteRequest,
) -> Result<CompleteResponse>
pub async fn complete( &self, request: CompleteRequest, ) -> Result<CompleteResponse>
Get completion suggestions for a resource or prompt parameter
Sourcepub async fn call_tool(
&self,
name: &str,
arguments: &Value,
) -> Result<ToolCallResult>
pub async fn call_tool( &self, name: &str, arguments: &Value, ) -> Result<ToolCallResult>
Call a tool on the server
Sourcepub async fn refresh_prompts(&self) -> Result<Value>
pub async fn refresh_prompts(&self) -> Result<Value>
Refresh the list of available prompts
Sourcepub async fn next_request_id(&self) -> Result<i64>
pub async fn next_request_id(&self) -> Result<i64>
Get the next request ID
Sourcepub async fn send_request(
&self,
method: &str,
params: Option<Value>,
id: String,
) -> Result<JsonRpcMessage>
pub async fn send_request( &self, method: &str, params: Option<Value>, id: String, ) -> Result<JsonRpcMessage>
Send a request and wait for a response
Sourcepub async fn register_sampling_callback(
&self,
callback: SamplingCallback,
) -> Result<()>
pub async fn register_sampling_callback( &self, callback: SamplingCallback, ) -> Result<()>
Register a sampling callback
Sourcepub async fn handle_message(&self, message: JsonRpcMessage) -> Result<()>
pub async fn handle_message(&self, message: JsonRpcMessage) -> Result<()>
Handle a received message
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