mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: fix(claude): preserve $defs in JSON schema for nested Pydantic models (#3655)
* fix(claude): preserve $defs in JSON schema for nested Pydantic models - Preserve $defs section from Pydantic JSON schema when converting FunctionTool to SDK MCP tool - This fixes tools with nested Pydantic models that use $ref references - Add test for nested type schema preservation Fixes #3654 * Adjust shared state import * Fix MCP tool kwargs serialization bug --------- Co-authored-by: Evan Mattson <evan.mattson@microsoft.com>
This commit is contained in:
co-authored by
Evan Mattson
parent
06d43ee130
commit
5c6cf4fc92
@@ -511,6 +511,9 @@ class ClaudeAgent(BaseAgent, Generic[TOptions]):
|
||||
"properties": schema.get("properties", {}),
|
||||
"required": schema.get("required", []),
|
||||
}
|
||||
# Preserve $defs for nested type references (Pydantic uses $defs for nested models)
|
||||
if "$defs" in schema:
|
||||
input_schema["$defs"] = schema["$defs"]
|
||||
|
||||
return SdkMcpTool(
|
||||
name=func_tool.name,
|
||||
|
||||
Reference in New Issue
Block a user