feat(agent): First-class Search API support via MCP (#8638)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Xingyao Wang
2025-05-24 00:07:48 +08:00
committed by GitHub
parent 20983a2128
commit a40443f5f4
25 changed files with 254 additions and 34 deletions

View File

@@ -207,6 +207,8 @@ def test_default_tools_microagent_exists():
async def test_add_mcp_tools_from_microagents():
"""Test that add_mcp_tools_to_agent adds tools from microagents."""
# Import ActionExecutionClient for mocking
from openhands.core.config.app_config import AppConfig
from openhands.runtime.impl.action_execution.action_execution_client import (
ActionExecutionClient,
)
@@ -217,6 +219,9 @@ async def test_add_mcp_tools_from_microagents():
mock_memory = MagicMock()
mock_mcp_config = MCPConfig()
# Create a mock AppConfig with the MCP config
mock_app_config = AppConfig(mcp=mock_mcp_config, search_api_key=None)
# Configure the mock memory to return a microagent MCP config
mock_stdio_server = MCPStdioServerConfig(
name='test-tool', command='test-command', args=['test-arg1', 'test-arg2']
@@ -242,9 +247,9 @@ async def test_add_mcp_tools_from_microagents():
'openhands.mcp.utils.fetch_mcp_tools_from_config',
new=AsyncMock(return_value=[mock_tool]),
):
# Call the function
# Call the function with the AppConfig instead of MCPConfig
await add_mcp_tools_to_agent(
mock_agent, mock_runtime, mock_memory, mock_mcp_config
mock_agent, mock_runtime, mock_memory, mock_app_config
)
# Verify that the memory's get_microagent_mcp_tools was called