pub struct CommonBackendImpl<T>where
T: Clone,{ /* private fields */ }
Expand description
Default backend implementation that can be used by macro-generated servers
Implementations§
Source§impl<T> CommonBackendImpl<T>where
T: Clone,
impl<T> CommonBackendImpl<T>where
T: Clone,
pub fn new(inner: T, server_info: ServerInfo) -> Self
Trait Implementations§
Source§impl<T> Clone for CommonBackendImpl<T>
impl<T> Clone for CommonBackendImpl<T>
Source§fn clone(&self) -> CommonBackendImpl<T>
fn clone(&self) -> CommonBackendImpl<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> McpBackend for CommonBackendImpl<T>
impl<T> McpBackend for CommonBackendImpl<T>
Source§type Error = CommonMcpError
type Error = CommonMcpError
Backend-specific error type
Source§fn initialize<'async_trait>(
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
fn initialize<'async_trait>(
config: Self::Config,
) -> Pin<Box<dyn Future<Output = Result<Self, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
Initialize the backend with configuration Read more
Source§fn get_server_info(&self) -> ServerInfo
fn get_server_info(&self) -> ServerInfo
Get server information and capabilities Read more
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Health check for the backend Read more
Source§fn list_tools<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_tools<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListToolsResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available tools with pagination
Source§fn call_tool<'life0, 'async_trait>(
&'life0 self,
request: CallToolRequestParam,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn call_tool<'life0, 'async_trait>(
&'life0 self,
request: CallToolRequestParam,
) -> Pin<Box<dyn Future<Output = Result<CallToolResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute a tool with the given parameters
Source§fn list_resources<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_resources<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListResourcesResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available resources with pagination
Source§fn read_resource<'life0, 'async_trait>(
&'life0 self,
request: ReadResourceRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read_resource<'life0, 'async_trait>(
&'life0 self,
request: ReadResourceRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ReadResourceResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read a resource by URI
Source§fn list_prompts<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_prompts<'life0, 'async_trait>(
&'life0 self,
_request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListPromptsResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List available prompts with pagination
Source§fn get_prompt<'life0, 'async_trait>(
&'life0 self,
request: GetPromptRequestParam,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_prompt<'life0, 'async_trait>(
&'life0 self,
request: GetPromptRequestParam,
) -> Pin<Box<dyn Future<Output = Result<GetPromptResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a specific prompt
Source§fn list_resource_templates<'life0, 'async_trait>(
&'life0 self,
request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_resource_templates<'life0, 'async_trait>(
&'life0 self,
request: PaginatedRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ListResourceTemplatesResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List resource templates (optional)
Source§fn subscribe<'life0, 'async_trait>(
&'life0 self,
request: SubscribeRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe<'life0, 'async_trait>(
&'life0 self,
request: SubscribeRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Subscribe to resource updates
Source§fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
request: UnsubscribeRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
request: UnsubscribeRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unsubscribe from resource updates
Source§fn complete<'life0, 'async_trait>(
&'life0 self,
request: CompleteRequestParam,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
request: CompleteRequestParam,
) -> Pin<Box<dyn Future<Output = Result<CompleteResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Complete tool or resource names
Source§fn elicit<'life0, 'async_trait>(
&'life0 self,
request: ElicitationRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ElicitationResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn elicit<'life0, 'async_trait>(
&'life0 self,
request: ElicitationRequestParam,
) -> Pin<Box<dyn Future<Output = Result<ElicitationResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request structured input from the user
Source§fn set_level<'life0, 'async_trait>(
&'life0 self,
request: SetLevelRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_level<'life0, 'async_trait>(
&'life0 self,
request: SetLevelRequestParam,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set logging level
Source§fn on_startup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_startup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called when the server is starting up
Source§fn on_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_shutdown<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Called when the server is shutting down
Source§fn on_client_connect<'life0, 'life1, 'async_trait>(
&'life0 self,
client_info: &'life1 Implementation,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_client_connect<'life0, 'life1, 'async_trait>(
&'life0 self,
client_info: &'life1 Implementation,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a client connects
Source§fn on_client_disconnect<'life0, 'life1, 'async_trait>(
&'life0 self,
client_info: &'life1 Implementation,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_client_disconnect<'life0, 'life1, 'async_trait>(
&'life0 self,
client_info: &'life1 Implementation,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Called when a client disconnects
Source§fn handle_custom_method<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_custom_method<'life0, 'life1, 'async_trait>(
&'life0 self,
method: &'life1 str,
params: Value,
) -> Pin<Box<dyn Future<Output = Result<Value, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle custom methods not part of the standard MCP protocol
Auto Trait Implementations§
impl<T> Freeze for CommonBackendImpl<T>where
T: Freeze,
impl<T> RefUnwindSafe for CommonBackendImpl<T>where
T: RefUnwindSafe,
impl<T> Send for CommonBackendImpl<T>where
T: Send,
impl<T> Sync for CommonBackendImpl<T>where
T: Sync,
impl<T> Unpin for CommonBackendImpl<T>where
T: Unpin,
impl<T> UnwindSafe for CommonBackendImpl<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more