Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/strands/tools/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _clean_pydantic_schema(self, schema: Dict[str, Any]) -> None:
schema: The Pydantic-generated JSON schema to clean up (modified in place).
"""
# Remove Pydantic metadata
keys_to_remove = ["title", "$defs", "additionalProperties"]
keys_to_remove = ["title", "additionalProperties"]
for key in keys_to_remove:
if key in schema:
del schema[key]
Expand Down
4 changes: 4 additions & 0 deletions src/strands/tools/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ def validate_tool_spec(self, tool_spec: ToolSpec) -> None:
}
continue

# It is expected that type and description are already included in referenced $def.
if "$ref" in prop_def:
continue

if "type" not in prop_def:
prop_def["type"] = "string"
if "description" not in prop_def:
Expand Down
5 changes: 5 additions & 0 deletions src/strands/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ def _normalize_property(prop_name: str, prop_def: Any) -> Dict[str, Any]:

# Copy existing property, ensuring defaults
normalized_prop = prop_def.copy()

# It is expected that type and description are already included in referenced $def.
if "$ref" in normalized_prop:
return normalized_prop

normalized_prop.setdefault("type", "string")
normalized_prop.setdefault("description", f"Property {prop_name}")
return normalized_prop
Expand Down