Display-filtered screenshots return the wrong monitor (or crash with IndexError) on hybrid-GPU systems

Author: naitik-forestallersCreated Sep 17, 2026Updated Sep 17, 2026

Summary

On a laptop with hybrid graphics (iGPU + dGPU, each driving a different monitor), display=[N] screenshots are broken in two different ways depending on N:

  • display=[0] → silently returns a different monitor's pixels, labeled with the requested monitor's coordinate region. No error.
  • display=[1] → IndexError: list index out of range, screenshot fails entirely.

The silent-wrong-monitor case is the dangerous one: an agent receives an image of monitor A annotated with monitor B's coordinate space, and any click it derives from that image lands in the wrong place on the wrong screen.

Root cause

resolve_dxcam_region() (src/windows_mcp/desktop/screenshot.py:40) derives output_idx by enumerating GetMonitorsRect():

python
monitor_rects = get_monitors_rect()
for output_idx, monitor_rect in enumerate(monitor_rects):

That index is then passed straight to dxcam (screenshot.py:66):

python
camera = module.create(output_idx=output_idx, processor_backend="numpy")

device_idx is never supplied, so it defaults to 0. But dxcam enumerates outputs per adapter, and on a hybrid-GPU machine each GPU owns one monitor:

Device[0]:<Device Name:Intel(R) Graphics Dedicated VRAM:128Mb VendorId:32902>
Device[1]:<Device Name:NVIDIA GeForce RTX 5070 Laptop GPU Dedicated VRAM:7891Mb VendorId:4318>

Device[0] Output[0]: Res:(2560, 1600) Rot:0 Primary:True
Device[1] Output[0]: Res:(1920, 1080) Rot:0 Primary:False

Both monitors are output_idx=0, on different devices. So:

  • output_idx=1 → self.outputs[0][1] → IndexError (device 0 has only one output).
  • output_idx=0 → always resolves to the Intel/primary panel, whatever monitor was asked for.

There is no general mapping from "Nth rect in GetMonitorsRect()" to "output_idx on device_idx=0". The two enumerations are unrelated — in this case they are not even in the same order: GetMonitorsRect()[0] is the 1920x1080 external, while dxcam Device[0] Output[0] is the 2560x1600 primary.

Reproduction

Two monitors driven by two different GPUs. Then:

Screenshot(display=[0])

Actual result — metadata is self-contradictory, and the image is the wrong screen:

Screenshot Original Size: (2560,1600)
Screenshot Region: (2560,67,4480,1147)      <- 1920x1080, the external monitor
Screenshot Backend: dxcam

The returned image is the 2560x1600 primary laptop panel, not the external monitor named in Screenshot Region. Note Original Size (2560x1600) and Region (1920x1080) disagree — the mismatch is detectable in-process.

Screenshot(display=[1])

Actual result:

Error capturing screenshot: list index out of range. Please try again.
Screenshot failed with display=[1]
Traceback (most recent call last):
  File "src\windows_mcp\tools\snapshot.py", line 90, in _screenshot_tool
  File "src\windows_mcp\tools\_snapshot_helpers.py", line 73, in capture_desktop_state
  File "src\windows_mcp\desktop\service.py", line 236, in get_state
  File "src\windows_mcp\desktop\service.py", line 1052, in get_screenshot
  File "src\windows_mcp\desktop\screenshot.py", line 155, in capture
  File "src\windows_mcp\desktop\screenshot.py", line 82, in capture_with_dxcam
  File "src\windows_mcp\desktop\screenshot.py", line 66, in get_dxcam_camera
    camera = module.create(output_idx=output_idx, processor_backend="numpy")
  File ".venv\Lib\site-packages\dxcam\__init__.py", line 262, in create
  File ".venv\Lib\site-packages\dxcam\__init__.py", line 151, in create
    output = self.outputs[device_idx][output_idx]
IndexError: list index out of range

Expected: each display=[N] returns the pixels of the monitor whose rect is GetMonitorsRect()[N], on any GPU topology.

Only reproduces when a screenshot is actually captured, so Snapshot(use_vision=False, display=[1]) succeeds (no capture) while Screenshot(display=[1]) fails. With no display filter, capture_rect is None and dxcam is skipped entirely (screenshot.py:151), which is why the unfiltered path has always looked fine.

Suggested fix

Resolve (device_idx, output_idx) as a pair by matching the monitor's actual rect/resolution against dxcam.output_info(), instead of reusing the GetMonitorsRect() position as an output index. Pass both to module.create(), and key camera_cache on the pair.

As defence in depth, assert that the captured frame's dimensions match the requested capture_rect before returning it, and fall back to another backend if they do not — that single check turns the silent wrong-monitor case into a caught failure.

Related: the IndexError also defeats the backend fallback chain — filed separately as #417.

Environment

- Windows-MCP: 0.7.2 (Claude Desktop extension channel, ant.dir.cursortouch.windows-mcp)
- OS: Windows 11 Pro 10.0.26200
- Python: CPython 3.13.15 (uv-managed)
- uv: 0.12.5
- Displays: 2 - primary 2560x1600 (laptop, Intel iGPU), secondary 1920x1080 (external, NVIDIA RTX 5070 Laptop)
- GPUs: hybrid - Device[0] Intel(R) Graphics, Device[1] NVIDIA GeForce RTX 5070 Laptop GPU
- Screenshot backend: auto