list
Lists available repositories discovered in the current directory to help identify project environments for building, testing, and managing software.
Instructions
List available repositories discovered in the current directory
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.py:471-482 (handler)The main handler function that implements the logic for the 'list' tool, formatting and returning a list of discovered repositories.async def handle_list(self) -> List[TextContent]: """Handle list command""" if not self.repos: return [TextContent(type="text", text="No repositories configured")] output = "Available repositories:\n\n" for name, info in self.repos.items(): output += f"- {name}\n" output += f" Path: {info.get('path', 'N/A')}\n" output += f" Description: {info.get('description', 'N/A')}\n\n" return [TextContent(type="text", text=output)]
- src/server.py:315-322 (schema)The schema definition for the 'list' tool, specifying no input parameters are required.Tool( name="list", description="List available repositories discovered in the current directory", inputSchema={ "type": "object", "properties": {}, "required": [] }
- src/server.py:453-455 (registration)Dispatch/registration logic in the central execute_tool method that handles calls to the 'list' tool by invoking handle_list.if name == "list": return await self.handle_list() elif name == "make":
- src/server.py:165-169 (registration)Registration of the list_tools handler which returns the list of available tools including 'list'.@self.server.list_tools() async def handle_list_tools() -> List[Tool]: """List available MCP tools""" return await self.get_tools_list()
- src/server.py:175-197 (helper)Helper function that discovers and populates the self.repos dictionary used by the 'list' tool handler.async def discover_repos(self): """Discover repositories by scanning the base directory for git repos""" self.repos = {} try: # Scan the base directory for subdirectories containing .git # Skip hidden directories (which include our managed worktrees) for item in REPOS_BASE_DIR.iterdir(): if item.is_dir() and not item.name.startswith('.'): git_dir = item / ".git" if git_dir.exists(): # This is a git repository repo_name = item.name self.repos[repo_name] = { "path": str(item), "description": f"Repository at {item.relative_to(REPOS_BASE_DIR)}" } logger.info(f"Discovered {len(self.repos)} repositories in {REPOS_BASE_DIR}") except Exception as e: logger.error(f"Error discovering repositories: {e}", exc_info=True) self.repos = {}