pub struct McpToolRegistry { /* private fields */ }Expand description
Implementations§
Source§impl McpToolRegistry
impl McpToolRegistry
Sourcepub fn from_config(config: &McpConfig) -> Self
pub fn from_config(config: &McpConfig) -> Self
从配置创建注册表
Sourcepub fn add_server(&mut self, name: String, config: McpServerConfig)
pub fn add_server(&mut self, name: String, config: McpServerConfig)
动态添加服务器(运行时)
Sourcepub async fn remove_server(&mut self, name: &str) -> Result<()>
pub async fn remove_server(&mut self, name: &str) -> Result<()>
移除服务器(如果已启动则先关闭)
Sourcepub fn get_server(&self, name: &str) -> Option<Arc<McpToolPlaceholder>>
pub fn get_server(&self, name: &str) -> Option<Arc<McpToolPlaceholder>>
获取服务器占位符
Sourcepub fn server_names(&self) -> Vec<&String>
pub fn server_names(&self) -> Vec<&String>
获取所有服务器名称
Sourcepub async fn started_servers(&self) -> Vec<String>
pub async fn started_servers(&self) -> Vec<String>
获取已启动的服务器列表
Sourcepub async fn server_status(&self) -> HashMap<String, ServerStatus>
pub async fn server_status(&self) -> HashMap<String, ServerStatus>
获取服务器状态(用于 TUI 显示)
Sourcepub async fn shutdown_all(&self)
pub async fn shutdown_all(&self)
关闭所有服务器
Sourcepub fn add_from_cli_arg(&mut self, arg: &str) -> Result<()>
pub fn add_from_cli_arg(&mut self, arg: &str) -> Result<()>
Sourcepub fn add_from_cli_args(&mut self, args: &[String]) -> Result<()>
pub fn add_from_cli_args(&mut self, args: &[String]) -> Result<()>
从 CLI 参数批量添加服务器
Trait Implementations§
Auto Trait Implementations§
impl Freeze for McpToolRegistry
impl !RefUnwindSafe for McpToolRegistry
impl Send for McpToolRegistry
impl Sync for McpToolRegistry
impl Unpin for McpToolRegistry
impl UnsafeUnpin for McpToolRegistry
impl !UnwindSafe for McpToolRegistry
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