def test_enable_sse():
    """Test the enable_sse function with various URL formats."""
    # Test query parameter detection (composio style)
    assert enable_sse("https://example.com/api?transport=sse") is True
    assert enable_sse("http://localhost:8080?transport=sse&other=param") is True
    assert enable_sse("https://example.com/api?other=param&transport=sse") is True

    # Test path suffix detection
    assert enable_sse("https://example.com/sse") is True
    assert enable_sse("http://localhost:8080/api/sse") is True
    assert enable_sse("https://example.com/sse/") is True

    # Test path containing /sse/
    assert enable_sse("https://example.com/api/sse/v1") is True
    assert enable_sse("http://localhost:8080/sse/events") is True
    assert enable_sse("https://example.com/v1/sse/stream") is True

    # Test non-SSE URLs
    assert enable_sse("https://example.com/api") is False
    assert enable_sse("http://localhost:8080") is False
    assert enable_sse("https://example.com/api?transport=http") is False
    assert enable_sse("https://example.com/assets") is False

    # Test edge cases
    assert enable_sse("https://example.com/sse-like") is False
    assert enable_sse("https://example.com/my-sse") is False
    assert enable_sse("https://example.com/api?sse=true") is False

    # Test with multiple transport values (should use first one)
    assert enable_sse("https://example.com?transport=sse&transport=http") is True

    # Test command-style inputs (non-URL)
    assert enable_sse("python") is False
    assert enable_sse("/usr/bin/python") is False
Test the enable_sse function with various URL formats.
llama-index-integrations/tools/llama-index-tools-mcp/tests/test_client.py