pub struct McpApi { /* private fields */ }Expand description
MCP system calls.
Implementations§
Source§impl McpApi
impl McpApi
Sourcepub fn list_servers(&self) -> Vec<String>
pub fn list_servers(&self) -> Vec<String>
List registered MCP servers.
Sourcepub fn get_server(&self, name: &str) -> Option<McpServer>
pub fn get_server(&self, name: &str) -> Option<McpServer>
Get MCP server info.
Sourcepub fn register_server(&self, server: McpServer)
pub fn register_server(&self, server: McpServer)
Register an MCP server.
Sourcepub async fn init_server(&self, name: &str) -> Result<()>
pub async fn init_server(&self, name: &str) -> Result<()>
Initialize a specific MCP server.
Sourcepub async fn client_status(&self, name: &str) -> Option<bool>
pub async fn client_status(&self, name: &str) -> Option<bool>
Get MCP client status.
Sourcepub async fn list_tools(&self) -> Result<Vec<ToolDef>>
pub async fn list_tools(&self) -> Result<Vec<ToolDef>>
List all MCP tools as ToolDefs.
Sourcepub async fn cached_tools(&self, server_name: &str) -> Option<Vec<ToolDef>>
pub async fn cached_tools(&self, server_name: &str) -> Option<Vec<ToolDef>>
Get cached tools for a server as ToolDefs.
Sourcepub async fn call_tool(
&self,
server: &str,
tool: &str,
arguments: Value,
) -> Result<McpToolCallResult>
pub async fn call_tool( &self, server: &str, tool: &str, arguments: Value, ) -> Result<McpToolCallResult>
Call an MCP tool.
Sourcepub fn server_count(&self) -> usize
pub fn server_count(&self) -> usize
Number of configured MCP servers.
Sourcepub async fn remove_server(&self, name: &str) -> Result<()>
pub async fn remove_server(&self, name: &str) -> Result<()>
Remove (disconnect and delete) an MCP server.
Sourcepub async fn toggle_server(&self, name: &str) -> Result<bool>
pub async fn toggle_server(&self, name: &str) -> Result<bool>
Toggle MCP server enabled/disabled. Returns the new enabled state.
Sourcepub async fn shutdown_all(&self) -> Result<()>
pub async fn shutdown_all(&self) -> Result<()>
Shutdown all MCP servers.
Auto Trait Implementations§
impl !RefUnwindSafe for McpApi
impl !UnwindSafe for McpApi
impl Freeze for McpApi
impl Send for McpApi
impl Sync for McpApi
impl Unpin for McpApi
impl UnsafeUnpin for McpApi
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