Skip to main content

RmcpClient

Struct RmcpClient 

Source
pub struct RmcpClient { /* private fields */ }
Expand description

A blocking MCP client backed by the official SDK.

Implementations§

Source§

impl RmcpClient

Source

pub fn name(&self) -> &str

Source

pub fn capabilities(&self) -> &ServerCapabilities

Source

pub fn protocol_version(&self) -> Option<&str>

Source

pub fn set_tool_meta(&mut self, meta: Value)

Source

pub fn list_tools(&self) -> Result<Vec<Tool>, McpError>

Source

pub fn call_tool( &self, name: &str, args: Option<Value>, ) -> Result<Value, McpError>

Source

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.

Source

pub fn list_resources(&self) -> Result<Vec<Resource>, McpError>

Source

pub fn read_resource(&self, uri: &str) -> Result<ReadResourceResult, McpError>

Source

pub fn list_prompts(&self) -> Result<Vec<Prompt>, McpError>

Source

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.

Source

pub fn unsubscribe(&self, uri: &str) -> Result<(), McpError>

Source

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).

Source

pub fn timeout(&self) -> Duration

The configured per-request timeout, for parity with the native client.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more