Trait LegacyResourceHandler

Source
pub trait LegacyResourceHandler: Send + Sync {
    // Required method
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        uri: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = McpResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn list<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = McpResult<Vec<ResourceInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Legacy trait for backward compatibility with existing tests This should be used for simple text-based resources

Required Methods§

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, uri: &'life1 str, ) -> Pin<Box<dyn Future<Output = McpResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the content of a resource as a string

§Arguments
  • uri - URI of the resource to read
§Returns

Result containing the resource content as a string or an error

Provided Methods§

Source

fn list<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = McpResult<Vec<ResourceInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all available resources

§Returns

Result containing a list of available resources or an error

Implementors§