update_server
Update the JVLink MCP Server to the latest version by pulling code changes and refreshing dependencies.
Instructions
サーバーを最新バージョンにアップデートする。git pull + 依存関係の更新を行います。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/jvlink_mcp_server/server.py:696-699 (handler)The 'update_server' tool definition which calls the 'perform_update' helper function.
def update_server() -> dict: """サーバーを最新バージョンにアップデートする。git pull + 依存関係の更新を行います。""" return perform_update() - The actual implementation of 'perform_update', which performs 'git pull' and 'uv sync' or 'pip install' to update the server.
def perform_update(confirmed: bool = False) -> dict: """Perform update: git pull + uv sync (or pip install -e .). Args: confirmed: Trueの場合のみ実際にアップデートを実行。 Falseの場合は確認メッセージを返す。 Returns dict with success, message, and details. """ results = {"success": False, "steps": []} # Step 1: Check for updates first info = check_for_updates() if info is None: results["message"] = "アップデートの確認に失敗しました" return results if not info["update_available"]: results["success"] = True results["message"] = f"最新バージョン {info['current_version']} です。アップデートは不要です。" return results results["from_version"] = info["current_version"] results["to_version"] = info["latest_version"] # 確認が未完了の場合は確認メッセージを返す if not confirmed: results["message"] = ( f"アップデートが利用可能です: {info['current_version']} → {info['latest_version']}\n" "実行するには confirmed=True を指定してください。\n" "注意: git pull と依存関係の更新が実行され、サーバーの再起動が必要になります。" ) results["requires_confirmation"] = True return results # Step 2: git pull try: result = subprocess.run( ["git", "pull", "--ff-only"], capture_output=True, text=True, cwd=str(PROJECT_ROOT), timeout=60, ) if result.returncode != 0: results["message"] = f"git pull 失敗: {result.stderr.strip()}" results["steps"].append({"git_pull": "failed", "error": result.stderr.strip()}) return results results["steps"].append({"git_pull": "success", "output": result.stdout.strip()}) except Exception as e: results["message"] = f"git pull エラー: {e}" return results # Step 3: uv sync or pip install -e . try: # Try uv first result = subprocess.run( ["uv", "sync"], capture_output=True, text=True, cwd=str(PROJECT_ROOT), timeout=120, ) if result.returncode == 0: results["steps"].append({"uv_sync": "success"}) else: raise FileNotFoundError("uv sync failed") except (FileNotFoundError, Exception): # Fallback to pip try: result = subprocess.run( [sys.executable, "-m", "pip", "install", "-e", "."], capture_output=True, text=True, cwd=str(PROJECT_ROOT), timeout=120, ) if result.returncode != 0: results["message"] = f"pip install 失敗: {result.stderr.strip()}" return results results["steps"].append({"pip_install": "success"}) except Exception as e: results["message"] = f"依存関係の更新に失敗: {e}" return results results["success"] = True results["message"] = ( f"アップデート完了: {info['current_version']} → {info['latest_version']}\n" "サーバーを再起動してください。" ) return results