strands.tools.structured_output.structured_output_utils
Tools for converting Pydantic models to Bedrock tools.
convert_pydantic_to_tool_spec
Section titled “convert_pydantic_to_tool_spec”def convert_pydantic_to_tool_spec(model: type[BaseModel], description: str | None = None) -> ToolSpecDefined in: src/strands/tools/structured_output/structured_output_utils.py:260
Converts a Pydantic model to a tool description for the Amazon Bedrock Converse API.
Handles optional vs. required fields, resolves $refs, and uses docstrings.
Arguments:
model- The Pydantic model class to convertdescription- Optional description of the tool’s purpose
Returns:
ToolSpec- Dict containing the Bedrock tool specification