Python: fix(ag-ui): add MCP tool support for AG-UI approval flows (#3212)

* add MCP tool support for AG-UI approval flows

* use attribute in place of property
This commit is contained in:
Evan Mattson
2026-01-15 11:34:11 +09:00
committed by GitHub
Unverified
parent 80b25a782b
commit 620da7a829
7 changed files with 234 additions and 111 deletions
@@ -114,10 +114,10 @@ class AgentFrameworkExecutor:
Args:
agent: Agent object that may have MCP tools
"""
if not hasattr(agent, "_local_mcp_tools"):
if not hasattr(agent, "mcp_tools"):
return
for mcp_tool in agent._local_mcp_tools:
for mcp_tool in agent.mcp_tools:
if not getattr(mcp_tool, "is_connected", False):
continue
@@ -248,9 +248,9 @@ class DevServer:
except Exception as e:
logger.warning(f"Error closing credential for {entity_info.id}: {e}")
# Close MCP tools (framework tracks them in _local_mcp_tools)
if entity_obj and hasattr(entity_obj, "_local_mcp_tools"):
for mcp_tool in entity_obj._local_mcp_tools:
# Close MCP tools (framework tracks them in mcp_tools)
if entity_obj and hasattr(entity_obj, "mcp_tools"):
for mcp_tool in entity_obj.mcp_tools:
if hasattr(mcp_tool, "close") and callable(mcp_tool.close):
try:
if inspect.iscoroutinefunction(mcp_tool.close):