pub struct RmcpClient { /* private fields */ }Expand description
A blocking MCP client backed by the official SDK.
Implementations§
Source§impl RmcpClient
impl RmcpClient
pub fn name(&self) -> &str
pub fn capabilities(&self) -> &ServerCapabilities
pub fn protocol_version(&self) -> Option<&str>
pub fn set_tool_meta(&mut self, meta: Value)
pub fn list_tools(&self) -> Result<Vec<Tool>, McpError>
pub fn call_tool( &self, name: &str, args: Option<Value>, ) -> Result<Value, McpError>
Sourcepub fn call_tool_with_meta(
&self,
name: &str,
args: Option<Value>,
extra_meta: Option<Value>,
) -> Result<Value, McpError>
pub fn call_tool_with_meta( &self, name: &str, args: Option<Value>, extra_meta: Option<Value>, ) -> Result<Value, McpError>
_meta (run id, idempotency key) rides on the arguments object, which is
where the wire carries it.
pub fn list_resources(&self) -> Result<Vec<Resource>, McpError>
pub fn read_resource(&self, uri: &str) -> Result<ReadResourceResult, McpError>
pub fn list_prompts(&self) -> Result<Vec<Prompt>, McpError>
Sourcepub fn subscribe(&self, uri: &str) -> Result<(), McpError>
pub fn subscribe(&self, uri: &str) -> Result<(), McpError>
Subscribe to a resource, by whichever mechanism the negotiated revision actually defines.
The two eras disagree: legacy uses resources/subscribe, and the
stateless revision replaces it with subscriptions/listen (rmcp
deprecates the former for that version). Since this backend speaks
whatever revision the SDK says is current, the choice has to be made
from the negotiated version rather than hard-coded — which also means it
starts using listen on its own the day rmcp promotes LATEST.
In the modern case one subscription covers every tracked URI: adding a URI reopens it with the widened filter, and its notifications pump into the queue the host drains.
pub fn unsubscribe(&self, uri: &str) -> Result<(), McpError>
Sourcepub fn drain_notifications(&self) -> Vec<Notification>
pub fn drain_notifications(&self) -> Vec<Notification>
Drain notifications the handler queued (same contract as the native client: take what has arrived, leave the queue empty).