MCP Commands - Screenshot Tools

<< Click to Display Table of Contents >>

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

MCP Commands - Screenshot Tools

SHOT.SCREEN - Capture Screenshot

PreviousTopNext


MiniRobot Language (MRL) - MCP Screenshot Tools Commands

 

MCP.Screenshot / SHOT.SCREEN

Capture Screenshot

 

Purpose

 

The SHOT.SCREEN command captures a screenshot of the current screen or a specified region. The captured image is saved to the MCP server's screenshot directory and can be used for visual analysis, documentation, or computer vision tasks. The command returns the file path of the captured screenshot.

 

This command is particularly useful when:

• Capturing the current screen state for analysis

• Creating documentation with visual references

• Performing computer vision tasks on screen content

• Debugging UI automation by capturing screen states

• Capturing specific regions of interest on the screen

 

Syntax

 

SHOT.SCREEN|$$RETURN_VAR

 

SHOT.SCREEN|$$X|$$Y|$$W|$$H|$$RETURN_VAR

 

Parameters

 

$$X (optional) - The X coordinate of the top-left corner of the capture region. If omitted, the entire screen is captured.

 

$$Y (optional) - The Y coordinate of the top-left corner of the capture region. If omitted, the entire screen is captured.

 

$$W (optional) - The width of the capture region in pixels. Required if X and Y are specified.

 

$$H (optional) - The height of the capture region in pixels. Required if X and Y are specified.

 

$$RETURN_VAR - The variable that will receive the full file path of the captured screenshot.

 

Return Value

 

The command returns the full file path to the captured screenshot image (PNG format). The file is saved in the MCP server's configured screenshot directory with a timestamp-based filename.

 

If the capture fails, an empty string is returned and an error is logged.

 

Examples

 

' Example 1: Capture full screen

SHOT.SCREEN|$$FilePath

PRT.Screenshot saved to: $$FilePath

 

' Example 2: Capture specific region

' Capture a 400x300 region starting at coordinates (100, 200)

SHOT.SCREEN|100|200|400|300|$$FilePath

IVV.$$FilePath!``

PRT.Region captured: $$FilePath

ELS.

PRT.Failed to capture screenshot

EIF.

 

' Example 3: Capture and store path for later use

SHOT.SCREEN|$$ScreenshotFile

MEM.S|LastScreenshot|$$ScreenshotFile

PRT.Screenshot saved. Use MEM.RCL|LastScreenshot to retrieve path.

 

Remarks

 

The SHOT.SCREEN command requires the ScreenshotTools feature to be enabled in the MCP server configuration. The screenshot is saved as a PNG file with a timestamp-based filename in the format screenshot_YYYYMMDD_HHMMSS.png.

 

When capturing a specific region, ensure that the coordinates and dimensions are within the screen boundaries. If the specified region exceeds screen boundaries, the capture may fail or be truncated depending on the server's implementation.

 

MCP.Screenshot and SHOT.SCREEN are aliases for the same command. You can use either form.

 

Error Conditions

 

The command will fail with an error if:

• The return variable parameter is missing

• The ScreenshotTools feature is disabled in the server configuration

• The screenshot directory cannot be accessed or written to

• The specified region coordinates are invalid

 

See also:

 

SHOT.GETLASTRECT - Get Last Screenshot Rectangle

SHOT.GETLASTRATIO - Get Last Screenshot Ratio

SHOT.GETQUADCENTER - Get Quadrant Center

SHOT.GETQUADRECT - Get Quadrant Rectangle

SHOT.SETCAPTUREMODE - Set Capture Mode

SHOT.SETFALLBACK - Set Fallback Mode

SHOT.SETPARSEMODE - Set Parse Mode

Screenshot Tools Overview