Take a screenshot
screenshotCaptures what the game displays and returns it as an MCP image, using render capture with a map or engine JPEG for menus and dialogs.
Instructions
Client only (unsupported on srcds). Captures what the game shows and returns it as an MCP image (plus {source, format, w, h, screen_w, screen_h, method, bytes}). Two sources, chosen by source (auto by default). render: what the local player sees, drawn by the engine; needs a loaded map (client realm); without w/h it is the game window as it is, HUD included (method backbuffer), with w/h the player's view rendered again at that size, without HUD or view model (method render_target); debug_draw primitives are visible; a minimized or frozen game gives timeout after 10 s. engine_jpeg: the engine's own jpeg console command, the only way to see the main menu, a VGUI2 dialog ("Disconnected by the server") or a loading screen, when there is no client realm. It is the engine's own capture, so it works while other windows cover the game, takes no focus and does not touch the window. The engine writes the picture to garrysmod/screenshots/.jpg and prints the name in its console; the module reads exactly that file and deletes it (and nothing else; result file, file_deleted, and a warning with the path if the file could not be deleted). The image is the game's screen size (the space ui_click coordinates are read on) as a JPEG at the engine's own quality (convar jpeg_quality, not changed): format, w, h and quality are not applied and, when given, are listed in ignored. A picture the user takes with their own jpeg command in the same instant can be mistaken for it. One capture at a time. Errors: realm_unavailable (source render without a map), unsupported (srcds), client_locked, capture_timeout (no Wrote line from the engine within 4 s: game minimized or frozen, or the console capture is off), capture_failed (the file named by the engine could not be taken; it is left in place and named). Example: {"w": 1280, "h": 720, "format": "png"} with a map, or {"source": "engine_jpeg"} at the main menu.
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 |
|---|---|---|---|
| h | No | Height in pixels (default: the game window's). | |
| w | No | Width in pixels (default: the game window's). | |
| format | No | Default jpeg. | |
| source | No | auto (default): the render capture when a map is loaded, the engine's jpeg command otherwise. render: the engine's render capture (client realm only). engine_jpeg: the engine's own `jpeg` console command, with or without a map (format, w, h and quality do not apply to it). | |
| quality | No | JPEG quality (default 90). | |
| instance | No | Optional. Instance identifier (see instances_list). If present and different from the local instance, the call is relayed by the coordinator to that instance. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| h | No | ||
| w | No | ||
| file | No | ||
| next | No | ||
| note | No | ||
| bytes | Yes | ||
| format | No | ||
| method | No | ||
| source | No | ||
| ignored | No | ||
| warning | No | ||
| screen_h | No | ||
| screen_w | No | ||
| next_call | No | ||
| capture_ms | No | ||
| answered_by | No | ||
| file_deleted | No | ||
| truncated_note | No | ||
| camera_restored | No | ||
| version_warning | No |