Skip to main content
Glama
aserper

RTFD (Read The F*****g Docs)

by aserper
test_github_packages.py2.39 kB
import pytest from RTFD.providers.github import GitHubProvider from RTFD.utils import create_http_client @pytest.mark.asyncio @pytest.mark.integration async def test_list_github_packages_and_versions(vcr): """Test listing GitHub packages and getting versions using VCR.""" provider = GitHubProvider(create_http_client) tools = provider.get_tools() # test list_github_packages # We use 'actions' org or similar that likely has packages # 'github' org also has packages # Note: Accessing packages often requires a token even for public ones via API, # but let's try with what we have. If it fails due to auth in CI, we might need to mock or ensure token. # The 'github' org definitely has public packages. # We will look for packages from 'github' # Use 'container' package type list_tool = tools["list_github_packages"] result = await list_tool(owner="github", package_type="container") # CallToolResult is an object, not a list assert result.content[0].type == "text" import json data = json.loads(result.content[0].text) # Check if we got results or error if data.get("error"): print(f"Got error: {data['error']}") pass else: assert "packages" in data assert isinstance(data["packages"], list) # If we found packages, let's try to get versions for one if data["count"] > 0: pkg = data["packages"][0] pkg_name = pkg["name"] pkg_owner = pkg["owner"] or "github" # API sometimes returns null owner in sub-object pkg_type = pkg["package_type"] get_versions_tool = tools["get_package_versions"] v_result = await get_versions_tool( owner=pkg_owner, package_type=pkg_type, package_name=pkg_name ) v_data = json.loads(v_result.content[0].text) if not v_data.get("error"): assert "versions" in v_data assert isinstance(v_data["versions"], list) assert v_data["count"] >= 0 @pytest.mark.asyncio @pytest.mark.integration async def test_github_packages_tools_registration(): """Verify tools are registered.""" provider = GitHubProvider(create_http_client) tools = provider.get_tools() assert "list_github_packages" in tools assert "get_package_versions" in tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aserper/RTFD'

If you have feedback or need assistance with the MCP directory API, please join our Discord server