Skip to content

anthropic_types

Class info

🛈 DocStrings

Anthropic SDK types for tool result content blocks.

This module defines a discriminated union of all possible content types that can appear in tool results from the Anthropic SDK. These types are used to provide proper typing for ToolResultBlock.content.

validate_tool_result_content

validate_tool_result_content(content: list[dict[str, object]]) -> list[ToolResultContentBlock]

Validate and parse raw tool result content into typed blocks.

Parameters:

Name Type Description Default
content list[dict[str, object]]

Raw list of content block dictionaries from CLI output

required

Returns:

Type Description
list[ToolResultContentBlock]

List of validated and typed content blocks

Source code in src/clawd_code_sdk/models/anthropic_types.py
def validate_tool_result_content(content: list[dict[str, object]]) -> list[ToolResultContentBlock]:
    """Validate and parse raw tool result content into typed blocks.

    Args:
        content: Raw list of content block dictionaries from CLI output

    Returns:
        List of validated and typed content blocks
    """
    return _get_adapter().validate_python(content)