def test_message_tool_response_serialization():
    """Test that tool responses are properly serialized."""
    # Create a message with tool response
    message = Message(
        role='tool',
        content=[TextContent(text='Function result')],
        tool_call_id='call_123',
        name='test_function',
    )

    # Serialize the message
    serialized = message.model_dump()

    # Check that tool response fields are properly serialized
    assert 'tool_call_id' in serialized
    assert serialized['tool_call_id'] == 'call_123'
    assert 'name' in serialized
    assert serialized['name'] == 'test_function'
Test that tool responses are properly serialized.
tests/unit/test_message_serialization.py