Files
agent-framework/python/packages
T
Giles Odigwe b0ac3939c1 Python: Fix MCP tools duplicated on second turn when runtime tools are present (#4432)
* Fix MCP tools duplicated on second turn when runtime tools are present

When AG-UI's collect_server_tools pre-expands MCP functions on turn 2
(after the MCP server is connected), _prepare_run_context unconditionally
appends them again from self.mcp_tools, duplicating every MCP tool.

Skip MCP functions whose names already exist in the final tool list,
following the same name-based dedup pattern used in _merge_options.

Fixes #4381

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* mypy fix

* Remove issue-specific references from test docstring

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
b0ac3939c1 ยท 2026-03-04 00:21:01 +00:00
History
..