revert(mcp): 移除MCP SSE客户端及工具集成支持

This commit is contained in:
明天好像没什么
2025-10-25 16:16:23 +08:00
committed by Windpicker-owo
parent 7395edf5b4
commit 37e16690bc
13 changed files with 24 additions and 1384 deletions

View File

@@ -17,12 +17,7 @@ def get_tool_instance(tool_name: str) -> BaseTool | None:
plugin_config = None
tool_class: type[BaseTool] = component_registry.get_component_class(tool_name, ComponentType.TOOL) # type: ignore
if tool_class:
return tool_class(plugin_config)
# 如果不是常规工具检查是否是MCP工具
# MCP工具不需要返回实例会在execute_tool_call中特殊处理
return None
return tool_class(plugin_config) if tool_class else None
def get_llm_available_tool_definitions():
@@ -34,17 +29,4 @@ def get_llm_available_tool_definitions():
from src.plugin_system.core import component_registry
llm_available_tools = component_registry.get_llm_available_tools()
tool_definitions = [(name, tool_class.get_tool_definition()) for name, tool_class in llm_available_tools.items()]
# 添加MCP工具
try:
from src.plugin_system.utils.mcp_tool_provider import mcp_tool_provider
mcp_tools = mcp_tool_provider.get_mcp_tool_definitions()
tool_definitions.extend(mcp_tools)
if mcp_tools:
logger.debug(f"已添加 {len(mcp_tools)} 个MCP工具到可用工具列表")
except Exception as e:
logger.debug(f"获取MCP工具失败可能未配置: {e}")
return tool_definitions