deargui-vpl/docs/taking-screenshots-mcp.md

2.3 KiB

Taking Screenshots Using MCP Computer Control Tools

This guide documents how to use MCP (Model Context Protocol) Computer Control tools to capture screenshots of the ImGui Node Editor application for testing and documentation purposes.

Overview

The MCP Computer Control MCP server provides screenshot capabilities that allow you to capture specific windows or the entire screen. This is useful for:

  • Testing the built-in screenshot functionality
  • Documenting features and UI changes
  • Debugging rendering issues
  • Creating visual documentation

Prerequisites

  1. MCP Server: Ensure the computer-control-mcp server is running and configured
  2. Application: Build and run the application
    sh ./run.sh
    

Alternative: Use the PowerShell command from project root:

cd C:\Users\zx\Desktop\polymech\extern\imgui-node-editor; cd build\bin; Start-Process -FilePath ".\blueprints-example_d.exe" -PassThru | Out-Null; Start-Sleep -Seconds 3

Wait 2-3 seconds for the application to fully initialize.

Use mcp_computer-control-mcp_list_windows to see all available windows and find your target:

3. Activate the Application Window

Activate the "Application" window using regex matching:

mcp_computer-control-mcp_activate_window(
    title_pattern="^NodeHub$",
    use_regex=True,
    threshold=10
)

Parameters:

  • title_pattern="^NodeHub$": Exact match for window title "NodeHub"
  • use_regex=True: Use regex for matching (allows ^$ anchors)
  • threshold=10: Minimum fuzzy match score (lower = more strict)

4. Wait for Window Activation

Give the system time to bring the window to foreground:

mcp_computer-control-mcp_wait_milliseconds(milliseconds=500)

5. Take Screenshot

Option A: Window-specific Screenshot

mcp_computer-control-mcp_take_screenshot(
    title_pattern="^NodeHub$",
    use_regex=True,
    threshold=10,
    save_to_downloads=True  # Optional: save to downloads folder
)

Option B: Full Screen Screenshot

mcp_computer-control-mcp_take_screenshot(
    save_to_downloads=True  # Optional: save to downloads folder
)