screenshot
Capture a PNG screenshot of the full screen or a specific window, optionally writing it to disk to avoid oversized inline base64 responses. Use as a fallback when accessibility tools cannot identify UI elements.
Instructions
Capture a screenshot as PNG. Last resort; prefer accessibility tools.
Pass window_id to crop to a specific window, or omit for full screen. Pass output_path (e.g. '/tmp/shot.png') to write the PNG to disk and get back {ok, path, width, height}. Strongly preferred for any real-window capture, since base64-inline screenshots routinely overflow the response token budget. Without output_path, returns {ok, data, width, height} with base64-encoded PNG bytes.
width/height are pixel dimensions; on retina displays a window with 720×450 logical points captures at 1440×900 px. Divide by the window's point size to recover the scale factor for coordinate math.
Errors with {ok: False, error: ...} if window_id is given but the window cannot be located. Does NOT silently fall back to a full-desktop capture.
Caveat on Linux/KWin: per-window capture crops a full-screen shot to the target window's rectangle, because the KDE compositor won't let unprivileged clients capture individual windows. Any other window on top of the target will appear in the crop. Raise or close overlapping windows before capturing if isolation matters. Windows and macOS capture per-window at the compositor level and are unaffected.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "screenshot"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| window_id | No | ||
| output_path | No |