Skip to main content
Glama
codingthefuturewithai

Code Understanding MCP Server

clone_repo

Clone a repository into the MCP cache to prepare it for code analysis. Required before using analysis endpoints like get_source_repo_map.

Instructions

    Clone a repository into MCP server's cache and prepare it for analysis.

    This tool must be called before using analysis endpoints like get_source_repo_map
    or get_repo_documentation. It copies the repository into MCP's cache and
    automatically starts building a repository map in the background.

    IMPORTANT - BEFORE CLONING:
        1. CHECK IF ALREADY CACHED: Use list_cached_repository_branches(url) first to avoid
           redundant clone attempts. Returns empty list if not cached, or existing branches if cached.

        2. VERIFY DEFAULT BRANCH NAME: Many repositories use "master", "develop", or other names
           instead of "main". If branch is not specified and clone fails:
           - Use list_remote_branches(url) to discover available branches
           - Look for "main", "master", "develop", or check repo documentation
           - Explicitly specify the correct branch parameter

        3. AFTER CLONING: The cached repository can become stale over time. Before analysis,
           consider using refresh_repo() to ensure you're working with the latest code.

    Args:
        url (str): URL of remote repository or path to local repository to analyze
        branch (str, optional): Specific branch to clone for analysis. Defaults to "main" if not
            specified, but many repositories use "master" or other names - verify first!
        cache_strategy (str, optional): Cache strategy - "shared" (default) or "per-branch"
            - "shared": One cache entry per repo, switch branches in place
            - "per-branch": Separate cache entries for each branch (useful for PR reviews)

    Returns:
        dict: Response with format:
            {
                "status": "pending" | "already_cloned" | "switched_branch" | "error",
                "path": str,  # Cache location where repo is being cloned
                "message": str,  # Status message about clone and analysis
                "cache_strategy": str,  # Strategy used for caching
                "current_branch": str,  # (if applicable) Current active branch
                "previous_branch": str,  # (if switched) Previous branch name
            }

    Recommended Workflow:
        1. Check cache: cached = list_cached_repository_branches(url)
        2. If not cached, discover branches: branches = list_remote_branches(url)
        3. Clone with correct branch: clone_repo(url, branch=discovered_branch)
        4. Before analysis, refresh if needed: refresh_repo(url)
        5. Perform analysis: get_source_repo_map(url, ...)

    Note:
        - This is a setup operation for MCP analysis only
        - Does not modify the source repository
        - Repository map building starts automatically after clone completes
        - Use get_source_repo_map to check analysis status and retrieve results
        - Per-branch strategy allows simultaneous access to different branches
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
branchNo
cache_strategyNoshared
Behavior4/5

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

Discloses key behaviors: no modification to source, background map building, cache strategy options, and indicates it is a setup operation. Lacks discussion of potential errors or time delays, but otherwise thorough given no annotations.

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?

Well-structured with clear sections (IMPORTANT, Args, Returns, Recommended Workflow, Note) and bullet points, but somewhat lengthy with some repetition; still efficient for the complexity.

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?

Comprehensive coverage including return format, recommended workflow, and notes on cache staleness and strategy; fully adequate for a setup tool with 3 parameters and no output schema.

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

Parameters4/5

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

Despite 0% schema coverage, the description adds detailed meaning for all three parameters (url, branch, cache_strategy), including defaults and usage notes, fully compensating for the schema gap.

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 clones a repository into MCP's cache for analysis, distinguishes from sibling tools like list_cached_repository_branches and list_remote_branches by specifying it is a setup operation required before analysis endpoints.

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

Usage Guidelines5/5

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

Provides explicit guidance on when to use the tool (before analysis), when not to (if already cached), and recommends checking cache and verifying branch first, with references to alternative tools.

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