workspace_info
Retrieve details about the current workspace, including path and git status, using the Moatless MCP Server for enhanced code analysis and editing workflows.
Instructions
Get information about the current workspace (path, git status, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The WorkspaceInfoTool class implements the 'workspace_info' tool handler, including the execute method that fetches and formats workspace information.class WorkspaceInfoTool(MCPTool): """Tool to get workspace information""" @property def name(self) -> str: return "workspace_info" @property def description(self) -> str: return "Get information about the current workspace (path, git status, etc.)" @property def input_schema(self) -> Dict[str, Any]: return { "type": "object", "properties": {} } async def execute(self, arguments: Dict[str, Any]) -> ToolResult: try: info = self.workspace.get_workspace_info() message_parts = [ f"Workspace Path: {info['path']}", f"Exists: {info['exists']}", f"Git Repository: {info['is_git_repo']}" ] if info.get('git_branch'): message_parts.append(f"Git Branch: {info['git_branch']}") if info.get('git_remote'): message_parts.append(f"Git Remotes: {', '.join(info['git_remote'])}") message = "\n".join(message_parts) return ToolResult( message=message, properties=info ) except Exception as e: logger.error(f"Error getting workspace info: {e}") return self.format_error(e)
- Input schema for the workspace_info tool, which requires no parameters (empty properties).@property def input_schema(self) -> Dict[str, Any]: return { "type": "object", "properties": {} }
- src/moatless_mcp/tools/registry.py:58-62 (registration)Registration of the WorkspaceInfoTool instance in the ToolRegistry's default tools list.# Search tools GrepTool(self.workspace), FindFilesTool(self.workspace), WorkspaceInfoTool(self.workspace),
- The get_workspace_info method in WorkspaceAdapter provides the core workspace data (path, git status, etc.) used by the tool handler.def get_workspace_info(self) -> Dict[str, Any]: """Get workspace information""" info = { "path": str(self.workspace_path), "exists": self.workspace_path.exists(), "is_git_repo": self.git_repo is not None, "moatless_available": MOATLESS_AVAILABLE, "index_initialized": self._index_initialized, } if self.git_repo: try: info["git_branch"] = self.git_repo.active_branch.name info["git_remote"] = [remote.name for remote in self.git_repo.remotes] except Exception as e: logger.warning(f"Error getting git info: {e}") return info