data360-mcp-explorer / src /data360 /tool_contract.py
Hugging Face Deployer
Deploy explorer to Hugging Face Spaces
2f203f5
Raw
History Blame Contribute Delete
709 Bytes
"""Shared versioning between MCP tool JSON contracts and `@data360/tool-types` / UI packages."""
from __future__ import annotations
import json
from functools import lru_cache
from importlib import resources
@lru_cache(maxsize=1)
def get_tool_contract_version() -> str:
"""Return the tool contract version (semver) shipped with this server build."""
raw = resources.files("data360").joinpath("tool_contract_version.json").read_text(
encoding="utf-8"
)
data = json.loads(raw)
version = data.get("version")
if not isinstance(version, str) or not version.strip():
raise ValueError("tool_contract_version.json: missing or invalid 'version'")
return version.strip()