diff --git a/connector_builder_mcp/validation_testing.py b/connector_builder_mcp/validation_testing.py index 52ed3dd..97bc80a 100644 --- a/connector_builder_mcp/validation_testing.py +++ b/connector_builder_mcp/validation_testing.py @@ -566,6 +566,16 @@ def run_connector_readiness_test_report( # noqa: PLR0912, PLR0914, PLR0915 (too if isinstance(streams, str): stream_names = [s.strip() for s in streams.split(",") if s.strip()] else: + if available_streams: + invalid_streams = [s for s in available_streams if not isinstance(s, dict)] + if invalid_streams: + raise ValueError( + f"Invalid manifest structure: 'streams' must be a list of stream definition objects (dicts), " + f"but found {len(invalid_streams)} invalid entry(ies). " + f"Each stream should be an object with at least a 'name' field and stream configuration. " + f"Invalid entries: {invalid_streams[:3]}" + ) + stream_names = [ stream.get("name", f"stream_{i}") for i, stream in enumerate(available_streams) ] diff --git a/tests/integration/test_validation_and_testing.py b/tests/integration/test_validation_and_testing.py index f043d66..df333ac 100644 --- a/tests/integration/test_validation_and_testing.py +++ b/tests/integration/test_validation_and_testing.py @@ -174,6 +174,32 @@ def test_simple_api_manifest_workflow(simple_api_manifest_yaml) -> None: assert "streams" in resolved_manifest +def test_malformed_manifest_streams_validation() -> None: + """Test that malformed manifest with streams as list of strings raises clear error.""" + malformed_manifest = """ +version: 4.6.2 +type: DeclarativeSource +check: + type: CheckStream + stream_names: + - test_stream +streams: + - test_stream + - another_stream +spec: + type: Spec + connection_specification: + type: object + properties: {} +""" + + with pytest.raises( + ValueError, + match=r"Invalid manifest structure.*streams.*must be a list of stream definition objects", + ): + run_connector_readiness_test_report(manifest=malformed_manifest, config={}, max_records=5) + + @pytest.mark.parametrize( "manifest_fixture,stream_name", [