Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions python/packages/core/agent_framework/_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,10 +1409,18 @@ async def _auto_invoke_function(
parsed_args: dict[str, Any] = dict(function_call_content.parse_arguments() or {})

# Filter out internal framework kwargs before passing to tools.
# This includes middleware infrastructure, chat options, tool configuration, and other
# framework-specific parameters that should not be forwarded to external tools.
framework_kwargs_to_filter = {
"_function_middleware_pipeline",
"middleware",
"chat_options",
"tools",
"tool_choice",
"thread",
}
runtime_kwargs: dict[str, Any] = {
key: value
for key, value in (custom_args or {}).items()
if key not in {"_function_middleware_pipeline", "middleware"}
key: value for key, value in (custom_args or {}).items() if key not in framework_kwargs_to_filter
}
try:
args = tool.input_model.model_validate(parsed_args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
metadata through the _meta field of CallToolResult objects.
"""

import logging

logging.basicConfig(level=logging.DEBUG)
Comment thread
moonbox3 marked this conversation as resolved.
Outdated


async def mcp_tools_on_run_level() -> None:
"""Example showing MCP tools defined when running the agent."""
Expand Down
Loading