mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
feat(MCP, microagent): MCP-support for Repo Microagent & add fetch as default tool (#8360)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
This commit is contained in:
@@ -5,6 +5,7 @@ from datetime import datetime, timezone
|
||||
from typing import Callable
|
||||
|
||||
import openhands
|
||||
from openhands.core.config.mcp_config import MCPConfig
|
||||
from openhands.core.logger import openhands_logger as logger
|
||||
from openhands.events.action.agent import RecallAction
|
||||
from openhands.events.event import Event, EventSource, RecallType
|
||||
@@ -262,6 +263,25 @@ class Memory:
|
||||
if isinstance(agent, RepoMicroagent):
|
||||
self.repo_microagents[name] = agent
|
||||
|
||||
def get_microagent_mcp_tools(self) -> list[MCPConfig]:
|
||||
"""
|
||||
Get MCP tools from all repo microagents (always active)
|
||||
|
||||
Returns:
|
||||
A list of MCP tools configurations from microagents
|
||||
"""
|
||||
mcp_configs: list[MCPConfig] = []
|
||||
|
||||
# Check all repo microagents for MCP tools (always active)
|
||||
for agent in self.repo_microagents.values():
|
||||
if agent.metadata.mcp_tools:
|
||||
mcp_configs.append(agent.metadata.mcp_tools)
|
||||
logger.debug(
|
||||
f'Found MCP tools in repo microagent {agent.name}: {agent.metadata.mcp_tools}'
|
||||
)
|
||||
|
||||
return mcp_configs
|
||||
|
||||
def set_repository_info(self, repo_name: str, repo_directory: str) -> None:
|
||||
"""Store repository info so we can reference it in an observation."""
|
||||
if repo_name or repo_directory:
|
||||
|
||||
Reference in New Issue
Block a user