editor_take_screenshot
Capture the current Unreal Editor view as a base64-encoded PNG image for documentation or debugging purposes.
Instructions
Take a screenshot of the Unreal Editor
Example output: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...
Returns a base64-encoded PNG image of the current editor view. IF THIS ERRORS OUT MAKE SURE THE UNREAL ENGINE WINDOW IS FOCUSED
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server/index.ts:458-493 (registration)Registration of the 'editor_take_screenshot' MCP tool, including inline handler that executes a Python script via remote Unreal Engine execution, processes the screenshot file to base64 image, schema (empty input).server.tool( "editor_take_screenshot", "Take a screenshot of the Unreal Editor\n\nExample output: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...\n\nReturns a base64-encoded PNG image of the current editor view. IF THIS ERRORS OUT MAKE SURE THE UNREAL ENGINE WINDOW IS FOCUSED", {}, async () => { const result = await tryRunCommand(editorTools.UETakeScreenshot()) const filePath = result.trim() const fullPath = path.resolve(filePath) await new Promise((resolve) => setTimeout(resolve, 3000)) if (fs.existsSync(fullPath)) { const base64Data = fs.readFileSync(fullPath, { encoding: "base64" }) fs.unlinkSync(fullPath) if (base64Data) { return { content: [ { type: "image", data: base64Data, mimeType: "image/png", }, ], } } } return { content: [ { type: "text", text: result || "Failed to take screenshot. Is the Unreal Engine window focused?", }, ], } }, )
- server/editor/tools.ts:78-78 (helper)Helper function that generates the Python command by reading and templating (no params) the ue_take_screenshot.py script.export const UETakeScreenshot = () => Template(read("./scripts/ue_take_screenshot.py"))
- Python script executed in Unreal Editor: captures high-res screenshot (640x520) using AutomationLibrary, saves to temp PNG file, prints the file path for the TS handler to read.import unreal import os from pathlib import Path import tempfile def take_screenshot() -> str: try: with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as temp_file: screenshot_path = temp_file.name unreal.AutomationLibrary.take_high_res_screenshot(640, 520, screenshot_path) return screenshot_path return "" except Exception: return "" def main(): path = take_screenshot() if path: print(path) else: print("Failed to take screenshot") if __name__ == "__main__": main()