mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: fix(core): filter out internal args when passing kwargs to MCP tools (#3292)
* fix(core): filter conversation_id when passing kwargs to MCP tools * Filter out options too * Fix uv.lock conflict
This commit is contained in:
committed by
GitHub
Unverified
parent
5436354a83
commit
50c2539f3a
@@ -754,8 +754,12 @@ class MCPTool:
|
||||
# Filter out framework kwargs that cannot be serialized by the MCP SDK.
|
||||
# These are internal objects passed through the function invocation pipeline
|
||||
# that should not be forwarded to external MCP servers.
|
||||
# conversation_id is an internal tracking ID used by services like Azure AI.
|
||||
# options contains metadata/store used by AG-UI for Azure AI client requirements.
|
||||
filtered_kwargs = {
|
||||
k: v for k, v in kwargs.items() if k not in {"chat_options", "tools", "tool_choice", "thread"}
|
||||
k: v
|
||||
for k, v in kwargs.items()
|
||||
if k not in {"chat_options", "tools", "tool_choice", "thread", "conversation_id", "options"}
|
||||
}
|
||||
|
||||
# Try the operation, reconnecting once if the connection is closed
|
||||
|
||||
@@ -1550,6 +1550,7 @@ 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.
|
||||
# conversation_id is an internal tracking ID that should not be forwarded to tools.
|
||||
runtime_kwargs: dict[str, Any] = {
|
||||
key: value
|
||||
for key, value in (custom_args or {}).items()
|
||||
|
||||
@@ -33,7 +33,6 @@ __all__ = [
|
||||
"FinishReason",
|
||||
"Role",
|
||||
"TextSpanRegion",
|
||||
"TextSpanRegion",
|
||||
"ToolMode",
|
||||
"UsageDetails",
|
||||
"add_usage_details",
|
||||
|
||||
Reference in New Issue
Block a user