Case: Testing the MCP module ooda-computer on a live application
Briefly
This case is not about a game but about testing the MCP-module ooda-computer — a set of tools for computer management (screenshots, mouse, keyboard, processes). The testing ground was the UWP application "Solitaire": it is not designed for automation, so it immediately exposed all weak points. The testing showed which tools in the module work out-of-the-box and which fail and require workarounds through WinAPI. It was particularly interesting how the model built computer vision from scratch: it found cards by color, recognized ranks by symbol shape (king by crown) and calibrated the table geometry on each cycle.
Technology Stack
| Technology | Role |
|---|---|
| MCP ooda-computer | Computer management: screenshots, mouse, keyboard, processes, CLI |
| Python | Computer vision, recognition, autonomous cycle |
| PowerShell | WinAPI calls, window and process management |
| mss (DWM) | Capture of UWP window images |
| SendInput (WinAPI) | Mouse input accepted by UWP application |
| Tesseract OCR | Card rank recognition |
| numpy / PIL | Pixel analysis, table segmentation |
| ctypes | Access to WinAPI from Python |
What was tested and why
The ooda-computer module is an MCP server that provides the agent with tools to manage the computer: take a screenshot, find an element on the screen (OCR), move the mouse, click, drag, press a key, launch a process, and execute a command in the CLI.
The task is to test the module on a live application. The formulation "open Solitaire from the tray and play" was deliberately chosen: it is a stress test. The UWP application "Solitaire" is not a typical .exe; it is rendered through the DWM compositor, does not hand over the window via the standard Win32 API, and does not accept synthetic input. If the module can handle this, it can handle regular tasks as well.
The goal of the testing is not to win a game but to answer the following questions:
| Question | What is being checked |
|---|---|
| Can the module see the application window? | Window and process enumeration tools |
| Does it receive a correct screenshot? | Screenshot tool on UWP content |
| Does the application accept clicks and drags? | Mouse input tools |
| Can the agent close the loop "see → understand → do → check"? | The entire chain of tools |
How the model approached the task
The first thing the model did was not to start clicking but to conduct an environmental reconnaissance. This is a key behavioral feature: gather facts about the environment first, then act.
Order of reconnaissance:
- Determine the OS (Windows) and find processes related to the solitaire game.
- Check if the found process has a window.
- Try to bring the window into focus.
- Only after this — examine the game field.
This order immediately revealed the first problem: the process exists, but there is no window.
Phase 1. Launching a UWP Application from the Tray
The process Solitaire.exe was already running in the system (PID 16488), but it had no windows:
MainWindowHandle = 0
MainWindowTitle = (empty)
This is the background host for the UWP application: it stays in the tray and does not create a window until the game is opened. The window enumeration tool (listWindows) also returned empty — the UWP window is not visible through the regular Win32 API.
The model checked several hypotheses:
- the window is minimized to the tray → focusing by PID did not work;
- the application is not launched by name → searching for a shortcut in the Start menu found the Microsoft Solitaire Collection package;
- launching through a UWP command → the process
ApplicationFrameHostappeared with the title "Solitaire & Casual Games" (PID 7676).
It is ApplicationFrameHost that is the UWP application's window. It was possible to focus this window (handle 6292598).
flowchart LR
A["Solitaire.exe<br>PID 16488<br>(no windows)"] --> B["listWindows: empty"]
B --> C["Search package<br>in Start menu"]
C --> D["Launch through UWP command"]
D --> E["ApplicationFrameHost<br>Solitaire and Casual Games<br>PID 7676"]
E --> F["Focus window"]
Conclusion on tools: process enumeration works, but window enumeration for UWP does not. Launching a process works, but for UWP, a separate path through a UWP command is needed.
Phase 2. The "vision" problem: the model cannot see pixels
Here a fundamental limitation was revealed, which the model honestly reported. The screenshot tool takes a snapshot, but the image is delivered to the user rather than returned to the model's context as analyzable pixels. In other words, the model cannot "look" at the image during reasoning.
This is an important test result: the screenshot tool alone does not give the agent vision. To analyze an image, the model must process it programmatically — through code.
The model proposed two paths:
- The user sends a screenshot and dictates the moves — but this is no longer autonomous work.
- The model connects recognition through an OCR tool (
findOnScreen) — but "Solitaire" draws cards graphically, and OCR works poorly on them.
Neither path provided autonomy. Then the model took a third path: build computer vision from scratch — save the screenshot to a file and analyze it with code (Python + PIL + numpy).
Phase 3. Building Computer Vision from Scratch
The model checked the available toolkit: Python is present, along with the libraries PIL/Pillow and numpy. This is sufficient to analyze pixels.
Next came a chain of steps, each providing more understanding of the scene.
Step 1. Obtain Window Coordinates
Using the Win32 API, the model retrieved the position and size of the solitaire window: position (313, 35), size 1216×941. This allowed for capturing a screenshot of exactly the window area, rather than the entire screen.
Step 2. Analyze Color Histogram
The first analysis was not about finding cards but rather a general overview of the colors. The result:
| Color | Share | What it is |
|---|---|---|
| Green | 72.5% | Tablecloth of the game table |
| White | 13.2% | Front sides of cards |
| Blue (0, 64, 160) | — | Backs of cards |
| Light gray (160–224) | — | Cards, shadows |
From this picture, the model identified the game: "Klondike" — the standard layout, 7 columns at the bottom, 4 foundation piles at the top, and a talon (deck) in the upper left corner.
Step 3. Find Card Positions
The next step was to find the white rectangles (fronts of cards) and group them by columns. The model sliced the card area into vertical strips and found the column boundaries by the horizontal gaps of the green tablecloth between cards.
The result was 7 columns with X centers:
| Column | X Center | X Range |
|---|---|---|
| 1 | 157 | 99–216 |
| 2 | 307 | 249–366 |
| 3 | 457 | 399–516 |
| 4 | 607 | 549–666 |
| 5 | 757 | 699–816 |
| 6 | 907 | 849–966 |
| 7 | ~1107 | 999–1215 |
Step 4. Understand the Layout Structure
The model found the Y positions of the cards within each column and discovered a pattern: the height of each column monotonically increases.
Column 1: 1 card (top card open at y≈316)
Column 2: 2 cards (y≈332)
Column 3: 3 cards (y≈348)
Column 4: 4 cards (y≈364)
Column 5: 5 cards (y≈379)
Column 6: 6 cards (y≈395)
Column 7: 7 cards (y≈411)
This is exactly the initial state of a new Klondike game: one open card at the top of each column, the rest face down. The model reconstructed the layout structure from pixels, without seeing the image.
Step 5. Find the Talon and Foundations
Separately, the model searched for the upper zone: the talon (deck) on the left — by the blue color of the card backs (x≈81–216, y≈100–280), and foundations — by the white cards at the top.
flowchart TD
A["Window screenshot"] --> B["Color histogram"]
B --> C["Game identification: Klondike"]
A --> D["Search for white rectangles"]
D --> E["7 columns by X"]
E --> F["Y positions of cards"]
F --> G["Layout structure"]
A --> H["Search for blue backs"]
H --> I["Talon"]
A --> J["White cards at the top"]
J --> K["Foundations"]
Conclusion from testing: The module does not provide vision to the agent but gives everything necessary to build it — screenshot to file, access to Python, access to WinAPI. The model assembled vision from these primitives.
Phase 4. GDI vs DWM: Why the Screenshot Turned Black
Initial analyses worked — the model saw the green table and cards. But at some point, the analysis started showing almost a black frame: the average pixel color was ~36, green felt 0%.
The model checked obvious hypotheses and ruled them out:
- The window lost focus → no, the window was foreground;
- The window was minimized → no,
IsIconic = 0; - The window was invisible → no,
IsWindowVisible = 1; - The window was partially obscured by another → partially, but did not fully explain the black frame;
- The handle was outdated → no, the same handle 6292598.
The real cause turned out to be in the capture method. UWP applications are rendered through DWM (Desktop Window Manager, desktop compositor). Traditional GDI capture through BitBlt does not get hardware-accelerated UWP content pixels — returns an empty or black area.
The solution is to capture through the mss library, which goes through DWM. After the switch, the frame became correct:
mean RGB (65, 132, 106) — green dominates
green frac 0.70 — 70% green felt
white frac 0.163 — 16.3% white cards
import mss
with mss.mss() as sct:
shot = sct.grab({"left": x, "top": y, "width": w, "height": h})
This also explained why the initial analyses worked: then the screenshot was taken by the MCP tool of the module, not the model's script through BitBlt. So the module's screenshot tool captures UWP correctly, while a homemade GDI capture does not.
Conclusion from testing: the module's screenshot tool works with UWP content. The problem only arose when the model started taking screenshots with its own code through GDI.
Phase 5. Mouse Input: Instrumental Drag Does Not Work
Clicking on the card worked immediately — the card flipped over in the open pile (waste). The model confirmed this by comparing segments before and after: a new segment x 249–415 appeared — the flipped card.
However, dragging the card between columns did not work. The model went through the options:
| Method | Result |
|---|---|
Instrumental mouseDrag |
card did not move |
mouseDrag with longer duration |
did not move |
mouse_event with button hold |
did not move |
SendInput (WinAPI) via ctypes |
worked |
Diagnosis: The UWP application ignores synthetic events sent not through low-level input. SendInput emulates input at the driver level, and the application accepts it.
import ctypes
# press → hold → move → release via SendInput
After switching to SendInput, dragging worked. Confirmed moves:
- 3 spades → 4 hearts;
- 2 clubs → 3 spades;
- king of clubs → empty column.
Final matrix for input:
| Action | Instrumental Call | SendInput |
|---|---|---|
| Click on card | works | works |
| Double-click (auto-move to foundation) | works | works |
| Dragging card | does not work | works |
Testing Conclusion: Clicks are performed correctly, but dragging on UWP applications requires a workaround via SendInput.
Phase 6. Card Recognition — Core of Computer Vision
The longest and most interesting part. To play meaningfully, the model needs to know the rank and suit of each open card. The model went through several approaches, errors, and discoveries here.
What Worked Reliably: Suit Color
The model determined the suit color (red/black) by analyzing pixels in the corner of the card. This proved reliable and sufficient for column transfers: the "Klondike" rule requires alternating colors.
First Approach: OCR
The model installed opencv-python-headless, pytesseract, and Tesseract 5.4 (via winget). It then extracted the card corner and recognized the rank.
The result was unstable. On small stylized symbols, OCR gave conflicting answers: 4A, A A, Q0, blank lines. The reason is that card symbols are too small (~15px) and drawn in a stylized font, unlike regular text.
The model added voting: for each card, multiple OCR attempts were made with different scales, thresholds, and modes (psm), and a consensus was taken. This stabilized the result — for example, 36 out of 36 agreed on the rank. Consistently readable: A, 3, 8, Q, K, 4, 2.
Second Approach: Template Matching — Failure
The model tried to match card symbols with template digits drawn programmatically (Arial font). The result was a score close to zero, almost random coincidence. The "Klondike" font is completely different in style, and the templates did not match.
Lesson: Template matching works only when the template and target are the same font. This was not the case here.
Discovery: Anatomy of a Card
The model made an enlarged ASCII dump of the card to understand where the elements were located. This gave key insights into the anatomy:
- Rank — in the upper left corner, occupying the topmost edge of the card (y+0..y+16), not y+4 as the model initially cropped;
- Suit — symbol below the rank;
- in the lower right corner — an inverted copy of rank+suit.
The model realized that its first crop was offset and cut off the rank from the top.
Discovery: Red Color is Lost in Grayscale
A separate nuance that caused trouble for a long time. The rank of red cards (hearts, diamonds) was not readable when converting the image to grayscale: the red symbol becomes gray (~130 brightness) and is lost in binarization by threshold.
Solution — color segmentation by the red channel instead of brightness:
# for red cards: highlight redness, not brightness
red_mask = R - max(G, B)
After this, red ranks became readable.
How the Model Recognized Cards by Shape of Symbols
Key point: when OCR failed, the model read glyphs visually — through enlarged ASCII dumps. It described the shape of the symbol and matched it with known ranks. This is essentially manual classification of shapes.
Examples of the model's reasoning by glyph shape:
| Card | How the Model Recognized It |
|---|---|
| Ace | A single large suit symbol, without a number |
| King | Crown — an uneven, complex structure at the top of the glyph, plus a long vertical line with diamonds below |
| Queen | Crown + long "tail" (vertical line) |
| Numerical | Simple shape of the number: for example, "8" — two loops, "2" — rounded top |
This is how the model identified King of Clubs: it saw an uneven structure at the top of the glyph, characteristic of a crown, and a long vertical line with diamond patterns below — this is the king's signature in this font. Similarly, the queen differed from the king by having a long tail.
This is essentially a heuristic classifier of shapes, built manually: the model did not have a trained model for recognition but derived features (crown, tail, loops, single symbol) and applied them.
What Did Not Work
- Suit Separation (spades vs clubs, hearts vs diamonds) — OCR gives only the rank, color gives red/black. For precise play, the full suit is needed, which the model could not reliably distinguish.
- OCR Stability — even with voting, small symbols were not always readable.
flowchart TD
A["Card"] --> B["Suit Color<br>(corner pixels)"]
A --> C["Rank"]
C --> D["OCR + voting"]
C --> E["Template matching<br>(failure)"]
C --> F["Visual analysis of glyph<br>(ASCII dump)"]
F --> G["Features: crown, tail,<br>loops, single symbol"]
B --> H["Red/Black"]
G --> I["Rank"]
Conclusion from Testing: The module does not provide ready image recognition. The model built it itself — from color segmentation to a heuristic classifier of shapes. This is the most substantive part of the experiment: essentially, manual assembly of computer vision from primitives.
Phase 7. Self-calibration of Table Geometry
Coordinates of the cards could not be fixed once. Over the course of the experiment, the window:
- shifted (origin 313 → 369 → 376);
- changed size;
- expanded to full screen (the layout changed: column centers 455, 623, 791, 959, 1127, 1295, 1463 with a step of ~168px).
Hard-coded coordinates constantly "drifted," and clicks missed their targets. The model spent many iterations recalibrating until it switched to self-calibration on each cycle.
The script redefines everything based on color and geometry:
- Window boundaries — through DWM (
DwmGetWindowAttributewithDWMWA_EXTENDED_FRAME_BOUNDS), not throughGetWindowRect. For UWP, they differ: DWM provided (376, 35, 1578, 969), whileGetWindowRectgave (369, 35, 1585, 976). - Foundations — white cards in the upper zone.
- Columns of the table — cards in the lower zone, grouped by vertical gaps of green baize.
- Talon and waste — by the blue color of the back and position relative to the foundations.
flowchart TD
A["Screenshot via mss"] --> B["Window boundaries (DWM)"]
A --> C["Foundations (white cards on top)"]
A --> D["Columns (cards at the bottom)"]
A --> E["Talon and waste (blue back)"]
B --> F["Global click coordinates"]
C --> F
D --> F
E --> F
This eliminated drift: each cycle starts with the current geometry.
Phase 8. Invisible Back: Deck Recharge
A separate discovery is the deck recharge mechanic. When a token is depleted, the back (cover) becomes invisible, and it is impossible to find it by color: a detector for a blue back returned nothing.
The model was unable to find it by color and went through the click positions. It turned out that clicking on an empty spot to the left of the waste pile recharges the deck, and cards start appearing again.
The back position is calculated from the waste pile: approximately 300 pixels to the left. The model checked: waste at x≈650, so the back ≈ 650 − 300 = 350; clicking the center of the back area (≈465) worked — the deck recharged, and a new card flipped over in the waste. This was confirmed by comparing segments before and after.
Lesson: invisible elements cannot be found by color — their position must be calculated by the layout logic.
Phase 9. Autonomous Game Cycle
The key mechanism that enabled progress without full recognition: a double-click on a card sends it to the foundation, only if the move is valid. The engine decides whether to accept the move or ignore it. Therefore, the cycle of "double-clicking all open cards" is safe: invalid moves simply do nothing.
flowchart LR
A["Screenshot"] --> B["Self-calibration"]
B --> C["Double-click on open cards"]
C --> D["Click on back (flip)"]
D --> E["Foundation check"]
E --> A
This cycle laid out all four aces in the foundations — autonomously, without hints on each move.
Phase 10. Two Monitors
During the experiment, it was found that the workstation had two monitors: Cherry Studio on one (DISPLAY2, x = −1366), and solitaire on the other (primary, 1920×1080). The virtual screen spanned from −1366 to 1920.
This added complexity: click coordinates had to be calculated in the global virtual screen system rather than within the bounds of a single monitor. After rotating solitaire to cover the entire primary monitor, the geometry simplified: the table occupied x 0–1920, y 0–1032.
Additionally, it was discovered that part of the issues with "black screen" and "misaligned coordinates" were caused by window overlap: a screen recording window and the Cherry Studio window appeared on top of the solitaire window. Initially, the model assumed this was a bug in its code until it checked the Z-order of the windows.
ooda-computer module tool matrix
Summary of test results — which tools in the module work on UWP applications and which do not.
| Tool | Purpose | Result on UWP | Comment |
|---|---|---|---|
| Process listing | Find application | Works | Found Solitaire.exe by PID |
| Window enumeration | Find window | Does not work | UWP window is not visible through Win32 API |
| Process launch | Launch application | Works | For UWP — through UWP command |
| Screenshot | Capture screen | Works | Correctly captures UWP content |
OCR (findOnScreen) |
Find element | Limited | Does not work with card graphics |
| Mouse click | Click | Works | Click on ticket confirmed |
| Double click | Auto-move | Works | Sends card to foundation |
Mouse drag (mouseDrag) |
Move | Does not work | UWP ignores synthetic drag |
| Mouse movement | Move cursor | Works | — |
| Keyboard | Press key | Works | — |
CLI (execCli) |
Execute command | Works | Through this — calls to WinAPI and Python |
Main limitations of the module, identified through testing:
- UWP windows are not visible through the window enumeration tool — a workaround through
ApplicationFrameHostis needed. - Dragging does not work on UWP — a workaround through
SendInputis needed. - Screenshot does not provide visual agent — the image goes to the user, not into the model context. Analysis is only possible through programmatic processing.
- OCR is not suitable for graphics — works with text but not with stylized card symbols.
Model Errors and How They Were Fixed
Testing is valuable not only for successes but also for how the model made mistakes and got out of dead ends.
Error 1. Incorrect Card Suit Color
The model identified the first card as black, although it was the red ace. The cause was that the region for determining the color was taken from a white background where the red symbol was small. Fix: take the region with the symbol itself, not the background.
Error 2. Column Confusion After Shift
After a card went to the foundation, the layout shifted, and the model attributed cards to the wrong columns. Fix: rebind cards to the new geometry after each move.
Error 3. Unstable Foundation Detector
The card counter in the foundation fluctuated 2 → 3 → 2, although cards were only being added. The cause was that cards in the foundation overlapped, and segmentation by white did not reliably distinguish them. The model stopped relying on the counter and started checking the state visually.
Error 4. False Move Output
The model decided that a two had gone to the foundation, although it did not happen — segmentation gave noise. Fix: check the move by comparing the state before and after, not by a single feature.
Error 5. Misaligned Rank Crop
The model cropped the corner of the card starting at y+4 and trimmed the rank from the top. Fix: the rank occupies the very top edge (y+0..y+16).
Error 6. Red Rank Lost in Grayscale
Red symbols were not readable when converted to grayscale. Fix: color segmentation by the red channel.
Error 7. Window Overlap Mistaken for Bug
A black screen and misaligned coordinates the model initially attributed to its own code, until it checked the Z-order of windows — a recording window and Cherry Studio were above the solitaire.
User Reference Calibration
A separate episode, exemplary for assessing recognition accuracy. The user provided a precise description of the layout in words:
- top (waste): 8 spades, 5 clubs, king of spades;
- top (foundation): ace;
- bottom (7 columns): king of clubs, 8 spades, 8 hearts, queen of spades, 3 hearts, stack 4 spades → 3 diamonds → 2 clubs, 9 clubs.
The model compared this with the result of its own recognition. The ranks matched almost perfectly (A, 3, 8, Q, K, 4, 2). The discrepancy was only in the suit color of the first card. This confirmed that the heuristic classifier for layouts worked correctly, while the weak point was determining the suit, not the rank.
The reference also helped the model recalibrate its recognition and understand exactly where it was making mistakes.
Testing Results
The ooda-computer module has passed the stress testbed test. Key findings:
What the module can do:
- launch applications (including UWP — via a separate path);
- take correct screenshots, including UWP content;
- perform clicks and double-clicks;
- execute commands in CLI (through which — calls to WinAPI and Python);
- work with the keyboard and mouse movement.
Where the module encounters limitations:
- does not list UWP windows;
- dragging and dropping does not work on UWP applications;
- the agent does not provide a screenshot for vision — software processing is required;
- OCR is not suitable for graphics.
What the model built on top of the module:
- computer vision from scratch (color segmentation, card search, layout structure);
- rank recognition through OCR with voting;
- heuristic classifier for card forms (crown for king, tail for queen, loops for numbers);
- self-calibration of table geometry in each cycle;
- autonomous cycle "screenshot → calibration → double-click → card flip → verification."
Confirmed autonomous actions:
| Action | Result |
|---|---|
| Launch UWP application from tray | confirmed |
| Click on card (card flip) | confirmed |
| Move 3 spades → 4 clubs | confirmed |
| Move 2 hearts → 3 spades | confirmed |
| King of spades → empty column | confirmed |
| Red two → foundation | confirmed |
| All four aces in foundations | confirmed |
Conclusions
- UWP is not a regular application. The window is not visible through the Win32 API, a GDI screenshot yields a black screen, and instrumental drag is ignored. Each issue had to be solved individually.
- A screenshot is not vision. The tool takes a snapshot, but the image does not enter the model's context. Analysis is only possible through programmatic processing—the model constructs it itself.
- Capture through DWM is mandatory for UWP.
BitBltdoes not receive pixels from the compositor;mssdoes. - Input through
SendInputis the only reliable path for UWP. Synthetic events at the instrumental level are not accepted by the application. - Coordinates cannot be fixed. The window moves, changes size, and layout changes. Self-calibration by color and geometry on each cycle resolves this.
- Invisible elements are found by logic, not color. The card deck's recharge back is invisible—it is located from the waste pile.
- Recognition can be built from primitives. Color segmentation + OCR with voting + heuristic by symbol shape provided a working classifier for cards without a trained model.
- Symbol shape is a working feature. The King was recognized by the crown (an irregular structure at the top of the glyph), the Queen by the tail, and numbers by loops. This is manual feature engineering.
- A safe cycle is more important than precise recognition. A double-click, which the engine validates itself, provided progress where full card recognition was still not ready.
- Model errors are part of the result. Incorrect suit color, column confusion, unstable detector, shifted crop, loss of red in grayscale—each error was found and corrected, showing how the model debugs its own vision.
