fix: filter out the enable extension tool in the ui as it should always ask for permission (#2186)
This commit is contained in:
@@ -32,6 +32,7 @@ use mcp_core::{
|
||||
prompt::Prompt, protocol::GetPromptResult, tool::Tool, Content, ToolError, ToolResult,
|
||||
};
|
||||
|
||||
use super::platform_tools;
|
||||
use super::tool_execution::{
|
||||
ExtensionInstallResult, ToolFuture, CHAT_MODE_TOOL_SKIPPED_RESPONSE, DECLINED_RESPONSE,
|
||||
};
|
||||
@@ -272,10 +273,22 @@ impl Agent {
|
||||
|
||||
pub async fn list_tools(&self) -> Vec<Tool> {
|
||||
let extension_manager = self.extension_manager.lock().await;
|
||||
extension_manager
|
||||
let mut prefixed_tools = extension_manager
|
||||
.get_prefixed_tools()
|
||||
.await
|
||||
.unwrap_or_default()
|
||||
.unwrap_or_default();
|
||||
|
||||
// Add platform tools
|
||||
prefixed_tools.push(platform_tools::search_available_extensions_tool());
|
||||
prefixed_tools.push(platform_tools::enable_extension_tool());
|
||||
|
||||
// Add resource tools if supported
|
||||
if extension_manager.supports_resources() {
|
||||
prefixed_tools.push(platform_tools::read_resource_tool());
|
||||
prefixed_tools.push(platform_tools::list_resources_tool());
|
||||
}
|
||||
|
||||
prefixed_tools
|
||||
}
|
||||
|
||||
pub async fn remove_extension(&mut self, name: &str) {
|
||||
|
||||
Reference in New Issue
Block a user