refresh_repo
Updates a cached repository with the latest changes from the source, then rebuilds the repository map to ensure analysis reflects current code.
Instructions
Update a previously cloned repository in MCP's cache and refresh its analysis.
CRITICAL: Cached repositories become stale over time. ALWAYS refresh before analysis
to ensure you're working with the latest code. Failure to refresh means your analysis
may be based on outdated code that could be days, weeks, or months old.
For Git repositories, performs a git pull to get latest changes.
For local directories, copies the latest content from the source.
Then triggers a new repository map build to ensure all analysis is based on
the updated code.
RECOMMENDED WORKFLOW:
1. Check if repository is cached: list_cached_repository_branches(url)
2. If cached, ALWAYS refresh first: refresh_repo(url)
3. Wait a moment for refresh to complete
4. Then perform analysis: get_source_repo_map(url, ...)
This ensures your analysis reflects current code, not stale cached data.
Args:
repo_path (str): Path or URL matching what was originally provided to clone_repo
branch (str, optional): Specific branch to switch to during refresh
cache_strategy (str, optional): Cache strategy - must match original clone strategy
Returns:
dict: Response with format:
{
"status": str, # "pending", "switched_branch", "error"
"path": str, # (On pending) Cache location being refreshed
"message": str, # (On pending) Status message
"error": str # (On error) Error message
"cache_strategy": str # Strategy used for caching
}
Note:
- Repository must be previously cloned and have completed initial analysis
- Updates MCP's cached copy, does not modify the source repository
- Automatically triggers rebuild of repository map with updated files
- If branch is specified, switches to that branch after pulling latest changes
- cache_strategy should match the strategy used during original clone
- Operation runs in background, check get_repo_map_content for status
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch | No | ||
| repo_path | Yes | ||
| cache_strategy | No | shared |