Skip to content

Screenshot Server

screenshot_server (doc_processing_std_tools.screenshot, MCP name screenshot-tools) captures the screen of the machine the server process runs on and returns it to the model as an image, or saves it as a PNG. It needs the screenshot extra (mss and Pillow).

Its tools capture the real screen of the machine the server runs on: in a container, usually nothing useful; on a user's machine, whatever is on their screen. For an agent's own desktop, use the computer server's computer_screenshot.

from doc_processing_std_tools import screenshot_server

This is the real screen

take_screenshot captures the actual monitors of the computer running std-tools. On a person's machine that includes everything open in other windows, and the image is sent to the model provider. Inside a container with no display, it returns an error. Attach this server only where capturing that screen is intended. It has no input capability: it cannot click or type. To act on a screen, use the Computer (Desktop) server, which works on its own virtual display by default and on the user's real screen only when explicitly configured.

Tools

Tool Key parameters Returns
take_screenshot output_path (optional), monitor (optional), region (optional) An image for the model when output_path is omitted; otherwise saves a PNG and returns its path
take_window_screenshot window_title, output_path Always an error explaining that window capture is not supported, with a take_screenshot(region=...) example

take_screenshot options:

  • monitor: 0 is all monitors combined (the default), 1 the first monitor, 2 the second, and so on. An index out of range returns an error listing the valid ones.
  • region: {"left": int, "top": int, "width": int, "height": int} in screen pixels. It overrides monitor.
  • output_path: the folder must already exist; the tool does not create folders.

Image size

New in 0.6.0. The image returned to the model is scaled down when its long edge is over DPTTOOLS_IMAGE_MAX_EDGE_PX (default 1568 px) or its encoded size is over DPTTOOLS_IMAGE_MAX_MB (default 3 MB), and may then arrive as JPEG. A capture within both limits is sent unchanged. A file written to output_path is always the full-resolution PNG. See Images.

Environment variables

Variable Default Effect here
DPTTOOLS_IMAGE_MAX_EDGE_PX 1568 Long-edge limit for the image returned to the model
DPTTOOLS_IMAGE_MAX_MB 3 Encoded-size limit for the image returned to the model

Examples

Tool calls are written as Python calls; the model sends the same arguments as JSON.

take_screenshot(monitor=1)
take_screenshot(region={"left": 0, "top": 0, "width": 1280, "height": 720})
take_screenshot(output_path="/workspace/captures/step-3.png")

Pitfalls

  • The default captures every monitor at once. Two full-HD screens give one 3840 × 1080 image, which is scaled to 1568 × 441 for the model, so text becomes hard to read. Prefer monitor=1 or a region.
  • Small text may need a region. A 2560 × 1440 monitor is scaled to 1568 × 882. Capture a region around what matters, or save to output_path and zoom with Image Tools.
  • In-process image results need toolkit 0.5.1 or later. See Compatibility.
  • No display, no capture. In a headless container the capture fails with an error. A virtual desktop started by the computer server is not this server's screen: capture it with computer_screenshot.