Skip to main content
Glama
codingthefuturewithai

Code Understanding MCP Server

list_remote_branches

Lists all branches in a remote repository without cloning. Use it to identify the default branch before cloning to avoid failures.

Instructions

    Discover all available branches in a remote repository without cloning.

    CRITICAL USE CASE: Many repositories use "master", "develop", or other names instead
    of "main" as their default branch. Use this tool BEFORE clone_repo to discover the
    actual default branch name and avoid clone failures.

    This tool uses git ls-remote --heads to query the remote repository, which is fast
    and does not require cloning the entire repository.

    Args:
        repo_url (str): Remote repository URL (e.g., https://github.com/user/repo)

    Returns:
        dict: Response with format:
            {
                "status": "success" | "error",
                "repo_url": str,  # Repository URL queried
                "remote_branches": [str],  # List of branch names (e.g., ["main", "develop", "feature-x"])
                "total_remote": int,  # Total number of branches found
                "error": str  # (Only on error) Error message
            }

    Common Default Branch Names to Look For:
        - "main" (modern GitHub default)
        - "master" (traditional Git default)
        - "develop" or "development" (common for dev workflows)
        - Check repository documentation if unclear

    Typical Workflow:
        1. Discover branches: branches = list_remote_branches(url)
        2. Identify default branch from branches["remote_branches"]
           - Look for "main", "master", or "develop"
           - If unsure, check the repository's web page
        3. Clone with correct branch: clone_repo(url, branch=identified_branch)

    Note:
        - Fast operation, does not clone the repository
        - Requires network access to the remote repository
        - Works with any Git repository (GitHub, GitLab, Bitbucket, etc.)
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_urlYes
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description must carry full burden. It describes using git ls-remote --heads, that it is fast and does not clone, and requires network access. It does not mention rate limits or potential error scenarios beyond a generic error field in the output. Could be more exhaustive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is well-structured with sections for critical use case, args, returns, common branch names, and workflow. Though lengthy, every section adds value and is easy to scan. Slightly verbose but justified.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter, no output schema, no annotations), the description is highly complete. It covers purpose, usage context, technical method, output format, real-world guidance on branch names, and a typical workflow. An agent can use this tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter repo_url with no schema description coverage. The description provides an example URL but does not add much meaning beyond the name. For a single required string parameter, this is adequate but minimal.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool discovers all branches in a remote repo without cloning. The verb 'discover' and resource 'branches in a remote repository' are specific. Distinguishes from siblings like 'clone_repo' by emphasizing it does not clone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly describes the critical use case of discovering default branch before cloning, and provides a typical workflow. However, it does not explicitly state when not to use this tool or mention alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/codingthefuturewithai/mcp-code-understanding'

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