start_project
Initialize a Python project with ty type checking to enable semantic code analysis, structural navigation, and accurate editing tools.
Instructions
Initialize ty for a Python project. Must be called first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes |
Implementation Reference
- src/mcp_ty/server.py:146-169 (handler)The implementation of the 'start_project' MCP tool, which initializes the TyLspClient and starts the analysis for a given project path.
async def start_project(project_path: str) -> str: """Initialize ty for a Python project. Must be called first.""" global _lsp_client path = Path(project_path).resolve() if not path.exists(): return _error(f"Path not found: {project_path}") if not path.is_dir(): return _error(f"Not a directory: {project_path}") if _lsp_client is not None: try: await _lsp_client.stop() except Exception: pass try: _lsp_client = TyLspClient() await _lsp_client.start(path) return _ok({"path": str(path), "initialized": True}) except Exception as e: _lsp_client = None logger.exception("Failed to start ty server") return _error(str(e))