Skip to main content
Glama
0xhackerfren

Frida Game Hacking MCP

by 0xhackerfren

screenshot_screen

Capture game screenshots for analysis by taking full-screen or region-specific images, saving as PNG files or returning base64 data for reverse engineering workflows.

Instructions

Take a screenshot of the entire screen or a region.

Args:
    save_path: Optional path to save the screenshot (PNG). If empty, returns base64.
    region: Optional [x, y, width, height] to capture specific region.

Returns:
    Screenshot info with base64 data or saved file path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
save_pathNo
regionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function for the 'screenshot_screen' tool. Captures screenshot of full screen or region using Windows DC APIs (GetDesktopWindow, BitBlt), converts BMP to PIL Image, and returns base64 PNG data or saves to file. Requires pywin32 and pillow.
    @mcp.tool()
    def screenshot_screen(save_path: str = "", region: List[int] = None) -> Dict[str, Any]:
        """
        Take a screenshot of the entire screen or a region.
        
        Args:
            save_path: Optional path to save the screenshot (PNG). If empty, returns base64.
            region: Optional [x, y, width, height] to capture specific region.
        
        Returns:
            Screenshot info with base64 data or saved file path.
        """
        if not SCREENSHOT_AVAILABLE:
            return {"error": "Screenshot support not available. Install: pip install pywin32 pillow"}
        
        try:
            # Get screen dimensions
            if region:
                x, y, width, height = region
            else:
                x, y = 0, 0
                width = ctypes.windll.user32.GetSystemMetrics(0)
                height = ctypes.windll.user32.GetSystemMetrics(1)
            
            # Capture screen
            hwnd = win32gui.GetDesktopWindow()
            hwnd_dc = win32gui.GetWindowDC(hwnd)
            mfc_dc = win32ui.CreateDCFromHandle(hwnd_dc)
            save_dc = mfc_dc.CreateCompatibleDC()
            
            bitmap = win32ui.CreateBitmap()
            bitmap.CreateCompatibleBitmap(mfc_dc, width, height)
            save_dc.SelectObject(bitmap)
            
            save_dc.BitBlt((0, 0), (width, height), mfc_dc, (x, y), win32con.SRCCOPY)
            
            # Convert to PIL Image
            bmp_info = bitmap.GetInfo()
            bmp_str = bitmap.GetBitmapBits(True)
            
            img = Image.frombuffer(
                'RGB',
                (bmp_info['bmWidth'], bmp_info['bmHeight']),
                bmp_str, 'raw', 'BGRX', 0, 1
            )
            
            # Cleanup
            win32gui.DeleteObject(bitmap.GetHandle())
            save_dc.DeleteDC()
            mfc_dc.DeleteDC()
            win32gui.ReleaseDC(hwnd, hwnd_dc)
            
            # Save or return base64
            if save_path:
                img.save(save_path, 'PNG')
                return {
                    "success": True,
                    "path": save_path,
                    "width": width,
                    "height": height
                }
            else:
                buffer = io.BytesIO()
                img.save(buffer, format='PNG')
                img_base64 = base64.b64encode(buffer.getvalue()).decode('utf-8')
                
                return {
                    "success": True,
                    "width": width,
                    "height": height,
                    "image_base64": img_base64,
                    "format": "png"
                }
        
        except Exception as e:
            return {"error": f"Screenshot failed: {str(e)}"}
  • The tool is listed under 'window_interaction' category in the list_capabilities tool, indicating its registration in the MCP server.
    "window_interaction": [
        "list_windows", "screenshot_window", "screenshot_screen",
        "send_key_to_window", "focus_window"
  • Imports and flag for Windows screenshot support (pywin32, pillow), required by the screenshot tools.
    # Screenshot support (Windows)
    SCREENSHOT_AVAILABLE = False
    try:
        import ctypes
        from ctypes import wintypes
        import win32gui
        import win32ui
        import win32con
        import win32process
        from PIL import Image
        SCREENSHOT_AVAILABLE = True
    except ImportError:
        pass
Behavior2/5

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

With no annotations provided, the description carries full burden but only mentions basic functionality. It doesn't disclose important behavioral traits like permissions needed, whether it requires user interaction, potential privacy implications, or error conditions. The description is minimal beyond stating the core action.

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

Conciseness5/5

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

Perfectly structured with a clear purpose statement followed by Args and Returns sections. Every sentence earns its place - no wasted words, front-loaded with the core functionality.

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

Completeness4/5

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

Given the tool has an output schema (returns screenshot info), the description doesn't need to detail return values. However, for a potentially privacy-sensitive screen capture tool with no annotations, it could benefit from more behavioral context about permissions or limitations.

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

Parameters5/5

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

With 0% schema description coverage, the description fully compensates by explaining both parameters: 'save_path' (optional path for PNG, returns base64 if empty) and 'region' (optional [x, y, width, height] array). It adds crucial meaning beyond the bare schema.

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

Purpose5/5

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

The description clearly states the verb 'take' and resource 'screenshot of the entire screen or a region', distinguishing it from sibling 'screenshot_window' which targets windows specifically. It's specific and immediately understandable.

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

Usage Guidelines4/5

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

The description implies usage for capturing screen/region screenshots but doesn't explicitly state when to choose this over 'screenshot_window' or other alternatives. It provides clear context about what it does but lacks explicit sibling differentiation.

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/0xhackerfren/frida-game-hacking-mcp'

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