Skip to content

strands.tools.structured_output.structured_output_utils

Tools for converting Pydantic models to Bedrock tools.

def convert_pydantic_to_tool_spec(model: type[BaseModel],
description: str | None = None) -> ToolSpec

Defined 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 convert
  • description - Optional description of the tool’s purpose

Returns:

  • ToolSpec - Dict containing the Bedrock tool specification