pub struct ResourcesReadHandler { /* private fields */ }Expand description
Resources read handler for resources/read endpoint only
Implementations§
Source§impl ResourcesReadHandler
impl ResourcesReadHandler
pub fn new() -> Self
Sourcepub fn with_security(self, middleware: Arc<SecurityMiddleware>) -> Self
pub fn with_security(self, middleware: Arc<SecurityMiddleware>) -> Self
Create handler with custom security middleware
Sourcepub fn without_security(self) -> Self
pub fn without_security(self) -> Self
Create handler without security middleware (for testing or trusted environments)
pub fn add_resource<R: McpResource + 'static>(self, resource: R) -> Self
pub fn add_resource_arc(self, resource: Arc<dyn McpResource>) -> Self
Sourcepub fn add_template_resource<R: McpResource + 'static>(
self,
template: UriTemplate,
resource: R,
) -> Self
pub fn add_template_resource<R: McpResource + 'static>( self, template: UriTemplate, resource: R, ) -> Self
Add a dynamic resource with URI template support
Sourcepub fn add_template_resource_arc(
self,
template: UriTemplate,
resource: Arc<dyn McpResource>,
) -> Self
pub fn add_template_resource_arc( self, template: UriTemplate, resource: Arc<dyn McpResource>, ) -> Self
Add a dynamic resource with URI template support (Arc version)
Trait Implementations§
Source§impl Default for ResourcesReadHandler
impl Default for ResourcesReadHandler
Source§impl McpHandler for ResourcesReadHandler
impl McpHandler for ResourcesReadHandler
Source§fn handle<'life0, 'async_trait>(
&'life0 self,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = McpResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
params: Option<Value>,
) -> Pin<Box<dyn Future<Output = McpResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an MCP request
Source§fn handle_with_session<'life0, 'async_trait>(
&'life0 self,
params: Option<Value>,
session: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = McpResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_with_session<'life0, 'async_trait>(
&'life0 self,
params: Option<Value>,
session: Option<SessionContext>,
) -> Pin<Box<dyn Future<Output = McpResult<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an MCP request with session context (default implementation calls handle)
Source§fn supported_methods(&self) -> Vec<String>
fn supported_methods(&self) -> Vec<String>
Get the methods this handler supports
Auto Trait Implementations§
impl Freeze for ResourcesReadHandler
impl !RefUnwindSafe for ResourcesReadHandler
impl Send for ResourcesReadHandler
impl Sync for ResourcesReadHandler
impl Unpin for ResourcesReadHandler
impl !UnwindSafe for ResourcesReadHandler
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.