list_windows
Identify and filter visible application windows by title to target specific processes for game hacking and reverse engineering tasks.
Instructions
List all visible windows.
Args:
filter_name: Optional filter to match window titles (case-insensitive)
Returns:
List of windows with handle, title, and associated PID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter_name | No |
Implementation Reference
- The handler function for the 'list_windows' MCP tool. Enumerates all visible top-level windows using win32gui.EnumWindows, filters by title if specified, retrieves PID and window geometry, and returns a structured list of windows.@mcp.tool() def list_windows(filter_name: str = "") -> Dict[str, Any]: """ List all visible windows. Args: filter_name: Optional filter to match window titles (case-insensitive) Returns: List of windows with handle, title, and associated PID. """ if not SCREENSHOT_AVAILABLE: return {"error": "Screenshot support not available. Install: pip install pywin32 pillow"} windows = [] def enum_callback(hwnd, _): if win32gui.IsWindowVisible(hwnd): title = win32gui.GetWindowText(hwnd) if title: if filter_name and filter_name.lower() not in title.lower(): return True try: _, pid = win32process.GetWindowThreadProcessId(hwnd) rect = win32gui.GetWindowRect(hwnd) width = rect[2] - rect[0] height = rect[3] - rect[1] if width > 0 and height > 0: windows.append({ "hwnd": hwnd, "title": title, "pid": pid, "x": rect[0], "y": rect[1], "width": width, "height": height }) except: pass return True try: win32gui.EnumWindows(enum_callback, None) return {"count": len(windows), "windows": windows} except Exception as e: return {"error": f"Failed to enumerate windows: {str(e)}"}
- src/frida_game_hacking_mcp/server.py:214-217 (registration)The 'list_windows' tool is registered and listed in the capabilities under the 'window_interaction' category in the list_capabilities tool."window_interaction": [ "list_windows", "screenshot_window", "screenshot_screen", "send_key_to_window", "focus_window" ],