Files
python-sdk/pkg/hanzo-tools-computer/hanzo_tools/computer/ui_tool.py
T
zeekay 4ebf26df3e feat(mcp): unify tool surfaces, rename iching→zen, fix test infrastructure
- Consolidate memory tools into single unified surface
- Rename IChingTool → ZenTool across agent tools
- Rename tool files: proc_tool→exec_tool, net_tool→fetch_tool,
  vcs_tool→git_tool, todo_tool→tasks_tool
- Add hanzo_tool.py for unified Hanzo API surface
- Add workspace_tool.py for config management
- Add hanzo-tools-ui package with GitHub API integration
- Add unified.py core tool dispatcher
- Update IAM client to RFC-compliant OAuth endpoints
- Fix pytest-asyncio plugin conflict: pin <1.0.0, fix addopts
  double-registration, and align test APIs to current signatures
- Fix integration tests: PermissionManager API, ReviewProtocol
  focus values, AgentTool parameter names, mock llm module for CI
2026-03-06 03:13:54 -08:00

69 lines
2.1 KiB
Python

"""Unified UI tool for HIP-0300 architecture.
This module provides a single unified 'ui' tool that consolidates:
- Computer control (click, type, screenshot, etc.)
- Screen recording (session, record, stop, analyze)
Following Unix philosophy: one tool for the Interface axis.
"""
from typing import Any, ClassVar
from mcp.server import FastMCP
from mcp.server.fastmcp import Context as MCPContext
from hanzo_tools.core import PermissionManager
from .computer_tool import ComputerTool
class UiTool(ComputerTool):
"""Unified UI tool (HIP-0300).
Consolidates computer + screen tools into single 'ui' tool.
Inherits all functionality from ComputerTool.
Actions:
- Mouse: click, double_click, right_click, middle_click, move, drag, scroll
- Touch: tap, swipe, pinch
- Keyboard: type, write, press, key_down, key_up, hotkey
- Screen capture: screenshot, screenshot_region, capture
- Screen recording: session, record, stop, analyze
- Image location: locate, locate_all, locate_center, wait_for_image
- Window: get_active_window, list_windows, focus_window
- Screen info: get_screens, screen_size, current_screen
- Region: define_region, region_screenshot, region_locate
- Batch: batch
"""
# Override name to 'ui' for HIP-0300
name: ClassVar[str] = "computer"
@property
def description(self) -> str:
return """Unified interface control tool (HIP-0300).
Actions:
- click, double_click, right_click, middle_click, move, drag, scroll
- tap, swipe, pinch (touch/mobile)
- type, write, press, key_down, key_up, hotkey (keyboard)
- screenshot, screenshot_region, capture
- session, record, stop, analyze (screen recording)
- focus_window, list_windows, get_active_window
- get_screens, screen_size
Cross-platform: macOS (Quartz), Linux (xdotool), Windows (win32api).
"""
def register(self, mcp_server: FastMCP) -> None:
"""Register as 'ui' tool with MCP server."""
# Delegate to parent registration but with 'ui' name
super().register(mcp_server)
# Backward compatibility aliases
ComputerToolAlias = UiTool
# For imports: from hanzo_tools.computer import ui_tool
ui_tool = UiTool