pub struct ServerBuilder { /* private fields */ }
Expand description
MCP server builder
Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn with_transport<T: Transport>(self, transport: T) -> Self
pub fn with_transport<T: Transport>(self, transport: T) -> Self
Set the transport to use
Sourcepub fn with_tool_manager(self, tool_manager: Arc<ToolManager>) -> Self
pub fn with_tool_manager(self, tool_manager: Arc<ToolManager>) -> Self
Set the tool manager
Sourcepub fn with_resource_manager(
self,
resource_manager: Arc<ResourceManager>,
) -> Self
pub fn with_resource_manager( self, resource_manager: Arc<ResourceManager>, ) -> Self
Set the resource manager
Sourcepub fn with_prompt_manager(self, prompt_manager: Arc<PromptManager>) -> Self
pub fn with_prompt_manager(self, prompt_manager: Arc<PromptManager>) -> Self
Set the prompt manager
Sourcepub fn with_tool(
self,
name: &str,
description: Option<&str>,
input_schema: Value,
handler: impl Fn(Value) -> Result<ToolCallResult> + Send + Sync + 'static,
) -> Self
pub fn with_tool( self, name: &str, description: Option<&str>, input_schema: Value, handler: impl Fn(Value) -> Result<ToolCallResult> + Send + Sync + 'static, ) -> Self
Register a tool (creates a tool manager if not already set)
Sourcepub fn with_resource(
self,
uri: &str,
name: &str,
description: Option<&str>,
mime_type: Option<&str>,
size: Option<u64>,
content_provider: impl Fn() -> Result<Vec<ResourceContent>> + Send + Sync + 'static,
) -> Self
pub fn with_resource( self, uri: &str, name: &str, description: Option<&str>, mime_type: Option<&str>, size: Option<u64>, content_provider: impl Fn() -> Result<Vec<ResourceContent>> + Send + Sync + 'static, ) -> Self
Register a resource (creates a resource manager if not already set)
Sourcepub fn with_template(
self,
uri_template: &str,
name: &str,
description: Option<&str>,
mime_type: Option<&str>,
expander: impl Fn(String, HashMap<String, String>) -> Result<String> + Send + Sync + 'static,
) -> Self
pub fn with_template( self, uri_template: &str, name: &str, description: Option<&str>, mime_type: Option<&str>, expander: impl Fn(String, HashMap<String, String>) -> Result<String> + Send + Sync + 'static, ) -> Self
Register a resource template (creates a resource manager if not already set)
Sourcepub fn with_template_completion(
self,
template_uri: &str,
provider: impl Fn(String, String, Option<String>) -> Result<Vec<CompletionItem>> + Send + Sync + 'static,
) -> Self
pub fn with_template_completion( self, template_uri: &str, provider: impl Fn(String, String, Option<String>) -> Result<Vec<CompletionItem>> + Send + Sync + 'static, ) -> Self
Register a template parameter completion provider
Sourcepub fn with_prompt_completion(
self,
prompt_name: &str,
param_name: &str,
provider: impl Fn(String, Option<String>) -> Result<Vec<String>> + Send + Sync + 'static,
) -> Self
pub fn with_prompt_completion( self, prompt_name: &str, param_name: &str, provider: impl Fn(String, Option<String>) -> Result<Vec<String>> + Send + Sync + 'static, ) -> Self
Register a prompt parameter completion provider
Auto Trait Implementations§
impl Freeze for ServerBuilder
impl !RefUnwindSafe for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl !UnwindSafe for ServerBuilder
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