Skip to main content
Glama

list_repo_labels

Retrieve available label names from a specified repository to organize and categorize issues effectively.

Instructions

list available labels for a repository

Args: repo: repository identifier in 'owner/repo' format

Returns: list of available label names for the repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesrepository identifier in 'owner/repo' format (e.g., 'zzstoatzz/tangled-mcp')

Implementation Reference

  • MCP tool handler for list_repo_labels, including input schema via Annotated Field, decorated with @tangled_mcp.tool for registration and execution.
    @tangled_mcp.tool
    def list_repo_labels(
        repo: Annotated[
            str,
            Field(
                description="repository identifier in 'owner/repo' format (e.g., 'zzstoatzz/tangled-mcp')"
            ),
        ],
    ) -> list[str]:
        """list available labels for a repository
    
        Args:
            repo: repository identifier in 'owner/repo' format
    
        Returns:
            list of available label names for the repository
        """
        # resolve owner/repo to (knot, did/repo)
        _, repo_id = _tangled.resolve_repo_identifier(repo)
        # list_repo_labels doesn't need knot (queries atproto records, not XRPC)
        return _tangled.list_repo_labels(repo_id)
  • The core helper function implementing the label listing logic by querying atproto repo records for subscribed label definitions.
    def list_repo_labels(repo_id: str) -> list[str]:
        """list available labels for a repository
    
        Args:
            repo_id: repository identifier in "did/repo" format
    
        Returns:
            list of available label names for the repo
        """
        client = _get_authenticated_client()
    
        if not client.me:
            raise RuntimeError("client not authenticated")
    
        # parse repo_id to get owner_did and repo_name
        if "/" not in repo_id:
            raise ValueError(f"invalid repo_id format: {repo_id}")
    
        owner_did, repo_name = repo_id.split("/", 1)
    
        # get the repo's subscribed label definitions
        records = client.com.atproto.repo.list_records(
            models.ComAtprotoRepoListRecords.Params(
                repo=owner_did,
                collection="sh.tangled.repo",
                limit=100,
            )
        )
    
        repo_labels: list[str] = []
        for record in records.records:
            if (
                name := getattr(record.value, "name", None)
            ) is not None and name == repo_name:
                if (subscribed_labels := getattr(record.value, "labels", None)) is not None:
                    # extract label names from URIs
                    repo_labels = [uri.split("/")[-1] for uri in subscribed_labels]
                break
    
        if not repo_labels and not any(
            (name := getattr(r.value, "name", None)) and name == repo_name
            for r in records.records
        ):
            raise ValueError(f"repo not found: {repo_id}")
    
        return repo_labels

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/zzstoatzz/tangled-mcp'

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