MCP Commands - Screenshot Tools

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > MCP. - MCP (Model-Context Protocol) server operations >

MCP Commands - Screenshot Tools

MCP Screenshot Tools - Overview

PreviousTopNext


MiniRobot Language (MRL) - MCP Server Feature

 

MCP Screenshot Tools

Screen Capture and Image Processing System

 

What are Screenshot Tools?

 

The MCP Screenshot Tools provide a comprehensive system for capturing screen images, configuring capture settings, and analyzing screen regions. These tools are essential for computer vision tasks, UI automation, documentation, and visual testing workflows. The screenshot system supports multiple capture modes, flexible output formats, and a quadrant-based coordinate system for easy screen segmentation.

 

Key Features

 

Flexible Capture Modes: Choose between GDI, DirectX, or PrintWindow capture methods

Multiple Output Formats: File path, Base64 encoded, compressed, or thumbnail

Region Capture: Capture full screen or specific rectangular regions

Quadrant System: 3x3 grid for easy screen segmentation and targeting

Fallback Support: Automatic fallback to alternative capture methods on failure

Capture History: Access rectangle and ratio information from last screenshot

 

Available Commands

 

Core Screenshot Commands:

SHOT.SCREEN - Capture full screen or specified region

 

Capture Information Commands:

SHOT.GETLASTRECT - Get rectangle coordinates (X, Y, W, H) of last screenshot

SHOT.GETLASTRATIO - Get aspect ratio (width/height) of last screenshot

 

Quadrant Commands:

SHOT.GETQUADCENTER - Get center coordinates of specified quadrant (1-9)

SHOT.GETQUADRECT - Get full rectangle (X, Y, W, H) of specified quadrant

 

Configuration Commands:

SHOT.SETCAPTUREMODE - Set capture method (Default, GDI, DirectX, PrintWindow)

SHOT.SETPARSEMODE - Set output format (File, Base64, Compressed, Thumbnail)

SHOT.SETFALLBACK - Enable/disable automatic fallback on capture failure

 

SLL Implementation

 

The Screenshot Tools are part of the CUTools (Computer Use Tools) category in the MCP SLL implementation. The implementation file is:

F:\00_MR\MR_Komponents\Internet-SLL\HTP_JSON_Lib\Tools\CUTools\MCP_Screenshot.inc

 

All screenshot commands use the SHOT. prefix as their MRL command name, with MCP.* aliases available for compatibility.

 

Capture Modes

 

0 - Default (Automatic):

Automatically selects the best available capture method based on system capabilities.

 

1 - GDI (BitBlt):

Uses standard Windows GDI BitBlt function. Widely compatible but may not capture layered windows or hardware-accelerated content.

 

2 - DirectX:

Uses DirectX for hardware-accelerated capture. Best for games and video content, requires DirectX support.

 

3 - PrintWindow:

Uses PrintWindow API. Can capture obscured windows and layered content, but may be slower.

 

Parse Modes

 

0 - File Path Only:

Returns only the file system path to the saved screenshot. Most efficient for local processing.

 

1 - Base64 Encoded:

Returns screenshot as Base64-encoded string. Useful for embedding in JSON or text protocols.

 

2 - Compressed:

Returns screenshot with additional compression. Optimized for network transmission.

 

3 - Thumbnail Preview:

Returns reduced-size thumbnail. Useful for quick previews when full resolution is not required.

 

Quadrant System

 

The screen is divided into a 3x3 grid, creating 9 equal quadrants numbered left-to-right, top-to-bottom:

 

+---+---+---+

| 1 | 2 | 3 | (Row 1: Top-Left, Top-Center, Top-Right)

+---+---+---+

| 4 | 5 | 6 | (Row 2: Middle-Left, Center, Middle-Right)

+---+---+---+

| 7 | 8 | 9 | (Row 3: Bottom-Left, Bottom-Center, Bottom-Right)

+---+---+---+

 

Each quadrant represents one-third of the screen width and one-third of the screen height. Use SHOT.GETQUADCENTER to get the center point, or SHOT.GETQUADRECT to get the full rectangle for capturing specific screen sections.

 

Example Usage

 

' Example 1: Capture full screen

SHOT.SCREEN|$$FilePath

PRT.Screenshot saved to: $$FilePath

 

' Example 2: Capture center quadrant only

SHOT.GETQUADRECT|5|$$CX|$$CY|$$CW|$$CH

SHOT.SCREEN|$$CX|$$CY|$$CW|$$CH|$$CenterShot

 

' Example 3: Configure for game capture with fallback

SHOT.SETCAPTUREMODE|2|$$ModeResult

SHOT.SETFALLBACK|1|$$FallbackResult

SHOT.SCREEN|$$GameScreenshot

 

' Example 4: Get screenshot info after capture

SHOT.SCREEN|$$Path

SHOT.GETLASTRECT|$$X|$$Y|$$W|$$H

SHOT.GETLASTRATIO|$$Ratio

PRT.Captured $$W x $$H at ($$X,$$Y) - Ratio: $$Ratio

 

Important Notes

 

• The ScreenshotTools feature requires the SCREENSHOT capability in MCP server configuration

• Screenshots are saved as PNG files with timestamp-based filenames

• Capture mode and parse mode settings persist for the server session

• Fallback mode (when enabled) tries: DirectX → GDI → PrintWindow on failure

• Quadrant coordinates are calculated based on current screen resolution

• Last screenshot data (rectangle, ratio) persists until server restart

 

See also:

 

SHOT.SCREEN - Capture Screenshot

SHOT.SETCAPTUREMODE - Set Capture Mode

SHOT.GETQUADRECT - Get Quadrant Rectangle

SHOT.GETLASTRECT - Get Last Screenshot Rectangle