mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
feat(agent): First-class Search API support via MCP (#8638)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user