Skip to main content
Glama
miyamamoto

JVLink MCP Server

by miyamamoto

update_server

Updates the server to the latest version by pulling changes from git and updating dependencies.

Instructions

サーバーを最新バージョンにアップデートする。git pull + 依存関係の更新を行います。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler that performs the update: checks for updates, runs git pull, and installs dependencies (uv sync or pip install -e .). Returns a dict with success status and details.
    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
  • Registration of 'update_server' as an MCP tool via @mcp.tool() decorator. Delegates to perform_update() in updater.py.
    @mcp.tool()
    def update_server() -> dict:
        """サーバーを最新バージョンにアップデートする。git pull + 依存関係の更新を行います。"""
        return perform_update()
  • Helper called within perform_update to check GitHub for available updates (releases/tags API).
    def check_for_updates() -> Optional[dict]:
        """Check GitHub for latest release.
    
        Returns dict with latest_version, current_version, update_available, html_url
        or None on failure.
        """
        import urllib.request
        import urllib.error
    
        current = get_current_version()
    
        # Try releases/latest first
        try:
            url = f"{GITHUB_API_URL}/releases/latest"
            req = urllib.request.Request(
                url,
                headers={"Accept": "application/vnd.github.v3+json", "User-Agent": GITHUB_REPO},
            )
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read().decode("utf-8"))
                latest = data.get("tag_name", "unknown")
                return {
                    "latest_version": latest,
                    "current_version": current,
                    "update_available": _version_newer(latest, current),
                    "html_url": data.get("html_url", ""),
                    "release_name": data.get("name", ""),
                    "body": data.get("body", ""),
                }
        except urllib.error.HTTPError as e:
            if e.code != 404:
                logger.debug("GitHub API error: %s", e.code)
                return None
        except Exception as e:
            logger.debug("Failed to check releases: %s", e)
            return None
    
        # Fallback: check tags
        try:
            url = f"{GITHUB_API_URL}/tags?per_page=1"
            req = urllib.request.Request(
                url,
                headers={"Accept": "application/vnd.github.v3+json", "User-Agent": GITHUB_REPO},
            )
            with urllib.request.urlopen(req, timeout=10) as resp:
                data = json.loads(resp.read().decode("utf-8"))
                if data:
                    latest = data[0].get("name", "unknown")
                    return {
                        "latest_version": latest,
                        "current_version": current,
                        "update_available": _version_newer(latest, current),
                        "html_url": f"https://github.com/{GITHUB_OWNER}/{GITHUB_REPO}/releases",
                        "release_name": "",
                        "body": "",
                    }
        except Exception as e:
            logger.debug("Failed to check tags: %s", e)
    
        return None
  • Import statement that brings perform_update into server.py so update_server can call it.
    from .updater import check_for_updates, perform_update, startup_update_check
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the core actions (git pull, dependency update) but lacks details on potential side effects (e.g., conflicts, service restarts, rollback). With no annotations, the description carries the full burden of transparency, which it only partially meets.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise and to the point. While it could include more contextual detail, it successfully conveys the essential functionality in an efficient manner.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the core functionality but omits contextual cues such as when to call this vs. check_update, expected output, or error states. For a simple tool, it is minimally adequate but leaves gaps for an agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so the description does not need to add parameter semantics. According to guidelines, baseline is 4 for zero parameters, and the description adequately conveys the tool's action without parameter ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool updates the server to the latest version via git pull and dependency updates, making the purpose specific and actionable. However, it does not explicitly distinguish from sibling 'check_update', which likely checks for updates without applying them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., check_update), nor any prerequisites or conditions for safe usage. The agent is left to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/miyamamoto/jvlink-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server