pub struct ResourceManager { /* private fields */ }Expand description
Resource manager for handling MCP resource operations
Implementations§
Source§impl ResourceManager
impl ResourceManager
Sourcepub fn new(manager: Arc<McpManager>) -> Self
pub fn new(manager: Arc<McpManager>) -> Self
Create a new resource manager
Sourcepub async fn list_all(&self) -> Vec<(String, McpResourceDefinition)>
pub async fn list_all(&self) -> Vec<(String, McpResourceDefinition)>
List all available resources from all connected servers
Sourcepub async fn list_from_server(
&self,
server_name: &str,
) -> McpResult<Vec<McpResourceDefinition>>
Available on crate feature mcp only.
pub async fn list_from_server( &self, server_name: &str, ) -> McpResult<Vec<McpResourceDefinition>>
mcp only.List resources from a specific server
Sourcepub async fn read(
&self,
server_name: &str,
uri: &str,
) -> McpResult<Vec<McpContent>>
pub async fn read( &self, server_name: &str, uri: &str, ) -> McpResult<Vec<McpContent>>
Read a resource
Sourcepub async fn read_text(&self, server_name: &str, uri: &str) -> McpResult<String>
pub async fn read_text(&self, server_name: &str, uri: &str) -> McpResult<String>
Read a resource as text
Sourcepub fn subscribe(&mut self, server_name: &str, uri: &str) -> usize
pub fn subscribe(&mut self, server_name: &str, uri: &str) -> usize
Subscribe to resource changes (placeholder for future implementation)
Returns the index of the newly created subscription, which can be used
with get_subscription() to retrieve it.
Sourcepub fn get_subscription(&self, index: usize) -> Option<&ResourceSubscription>
pub fn get_subscription(&self, index: usize) -> Option<&ResourceSubscription>
Get a subscription by index
Sourcepub fn unsubscribe(&mut self, server_name: &str, uri: &str)
pub fn unsubscribe(&mut self, server_name: &str, uri: &str)
Unsubscribe from resource changes
Sourcepub fn subscriptions(&self) -> &[ResourceSubscription]
pub fn subscriptions(&self) -> &[ResourceSubscription]
Get active subscriptions
Sourcepub async fn find_by_pattern(
&self,
pattern: &str,
) -> Vec<(String, McpResourceDefinition)>
pub async fn find_by_pattern( &self, pattern: &str, ) -> Vec<(String, McpResourceDefinition)>
Find resources by URI pattern
Auto Trait Implementations§
impl Freeze for ResourceManager
impl !RefUnwindSafe for ResourceManager
impl Send for ResourceManager
impl Sync for ResourceManager
impl Unpin for ResourceManager
impl !UnwindSafe for ResourceManager
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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.