list_cached_repository_branches
Check if a repository is cached and list all cached branch versions to avoid redundant clone attempts before analysis.
Instructions
Check if a repository is already cached and list all cached branch versions.
USE THIS FIRST before calling clone_repo to avoid redundant clone attempts.
If the repository is already cached, you can proceed directly to refresh_repo
and analysis instead of cloning again.
This tool scans the MCP cache to find all entries for a given repository URL,
showing both shared and per-branch cache entries. Useful for understanding
what branches are available and their current status.
Args:
repo_url (str): Repository URL to search for (must match exact URL used in clone_repo)
Returns:
dict: Response with format:
{
"status": "success" | "error",
"repo_url": str, # Repository URL searched
"cached_branches": [ # List of cached branch entries (empty if not cached)
{
"requested_branch": str, # Branch that was requested during clone
"current_branch": str, # Current active branch in the cache
"cache_path": str, # File system path to cached repository
"cache_strategy": str, # "shared" or "per-branch"
"last_access": str, # ISO timestamp of last access
"clone_status": dict, # Clone operation status
"repo_map_status": dict # Repository map build status
}
],
"total_cached": int # Total number of cached entries (0 if not cached)
}
Typical Workflow:
1. Check cache first: result = list_cached_repository_branches(url)
2. If result["total_cached"] > 0:
- Repository is cached, skip clone
- Use refresh_repo(url) to update cached code
3. If result["total_cached"] == 0:
- Repository not cached yet
- Use list_remote_branches(url) to discover branch names
- Use clone_repo(url, branch=correct_branch)
Note:
- Only returns repositories that have been cloned via clone_repo
- Empty cached_branches list means repository is NOT cached
- Useful for PR review workflows to see all available branch versions
- Shows both active and completed cache entries
- Helps identify which cache strategy was used for each entry
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_url | Yes |