switch_repository
Switch between initialized code repositories by specifying the target path. Facilitates seamless navigation and analysis of Python code dependencies within the Nuanced MCP Server.
Instructions
Switch to a different initialized repository.
Args: repo_path: Path to the repository to switch to
Returns: Success message or error
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes |
Implementation Reference
- nuanced_mcp_server.py:66-84 (handler)The main handler function for the 'switch_repository' MCP tool. It switches the active repository by setting the global _active_repo to the absolute path of the provided repo_path, after verifying it exists in the initialized _code_graphs dictionary. Includes docstring serving as input/output schema and is registered as a tool via the @mcp.tool() decorator.@mcp.tool() def switch_repository(repo_path: str) -> str: """Switch to a different initialized repository. Args: repo_path: Path to the repository to switch to Returns: Success message or error """ global _code_graphs, _active_repo abs_path = os.path.abspath(repo_path) if abs_path not in _code_graphs: return f"Error: Repository at '{repo_path}' has not been initialized. Use initialize_graph first." _active_repo = abs_path return f"Successfully switched to repository: {repo_path}"