mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-27 04:20:09 +00:00
- Update quality-gate.yml to only lint hanzo_mcp and tests directories
- Add ruff config to pyproject.toml:
- Exclude vscode-extension and node_modules
- Ignore lint rules that conflict with test patterns:
B023 (loop variable binding), B904 (raise from),
E741 (ambiguous vars), F401/F821/F841 (unused/undefined in tests)
- Apply per-file ignores for tests/ and __init__.py
- Apply ruff fixes for import sorting and format
52 lines
1.4 KiB
Python
52 lines
1.4 KiB
Python
"""Version tool for hanzo-mcp."""
|
|
|
|
import sys
|
|
|
|
from hanzo_async import using_uvloop
|
|
from mcp.server.fastmcp import FastMCP
|
|
|
|
import hanzo_mcp
|
|
|
|
|
|
def register_version_tool(mcp: FastMCP) -> None:
|
|
"""Register the version tool with the MCP server."""
|
|
|
|
@mcp.tool()
|
|
async def version() -> str:
|
|
"""Get hanzo-mcp version and environment information.
|
|
|
|
Returns version info including:
|
|
- hanzo-mcp version
|
|
- Python version
|
|
- Platform info
|
|
- Async backend (uvloop or asyncio)
|
|
"""
|
|
import platform
|
|
|
|
# Get uvloop version if active
|
|
async_backend = "asyncio"
|
|
if using_uvloop():
|
|
try:
|
|
import uvloop
|
|
|
|
async_backend = f"uvloop {uvloop.__version__}"
|
|
except ImportError:
|
|
async_backend = "uvloop"
|
|
|
|
info = {
|
|
"hanzo_mcp": hanzo_mcp.__version__,
|
|
"python": sys.version.split()[0],
|
|
"platform": platform.system(),
|
|
"arch": platform.machine(),
|
|
"async": async_backend,
|
|
}
|
|
|
|
# Return formatted string for clean display
|
|
lines = [
|
|
f"hanzo-mcp: v{info['hanzo_mcp']}",
|
|
f"python: {info['python']}",
|
|
f"platform: {info['platform']} ({info['arch']})",
|
|
f"async: {info['async']}",
|
|
]
|
|
return "\n".join(lines)
|