feat: add capture_screenshot and capture_scene_screenshot tools (fixes #88)#115
Open
Yoshyaes wants to merge 1 commit into
Open
feat: add capture_screenshot and capture_scene_screenshot tools (fixes #88)#115Yoshyaes wants to merge 1 commit into
Yoshyaes wants to merge 1 commit into
Conversation
…Coding-Solo#88) Add two MCP tools for visual debugging of Godot scenes. Both tools run Godot with a real rendering context (not --headless), capture a viewport frame via GDScript, and return the result as base64 PNG image content so AI agents can visually verify scenes. Changes: - src/scripts/godot_operations.gd: add capture_screenshot and capture_scene_screenshot operations using async coroutines, root.get_texture(), and img.flip_y() to correct Y-axis inversion from ViewportTexture - src/tools/capture.ts: standalone handlers that spawn Godot without --headless, write to a temp path, read and base64-encode the PNG, clean up the temp file - src/index.ts: register both tools in ListTools and CallTool - tests/fixtures/capture-test-project/: minimal Godot 4 project with a solid-red ColorRect scene for CI-style validation - src/tests/capture.test.ts: integration tests using node:test (no new deps); skip gracefully when Godot is not available - README.md: Visual Debugging section with parameter tables and xvfb-run guide Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
awils27
added a commit
to awils27/godot-mcp
that referenced
this pull request
Jun 17, 2026
# Conflicts: # src/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
capture_screenshotandcapture_scene_screenshotMCP tools that return a rendered Godot scene as a base64 PNG image, closing Feature Request: Visual Debugging / Automated Playtest Capture Tool #88godot_operations.gdbundled script (no new GDScript files, no autoloads, no editor plugins)--headlessso the renderer produces real pixels; fixes the Y-axis inversion fromViewportTexturewithimg.flip_y()Why this over the existing PRs
ScreenshotManagerautoload in the user's project, breaking the no-plugin architecturegodot_operations.gd; Y-axis flip bug; user-controlled output pathThis PR follows the same bundled-script pattern as every other tool and addresses all open review comments from #100.
How to test
Rendering context note
These tools require a real display (not
--headless). On a local dev machine (macOS, Windows, Linux desktop) they work out of the box. On headless Linux wrap Godot inxvfb-run-- see the README Visual Debugging section for the wrapper script pattern.What is not in this PR
record_playtest(capture a frame sequence over N seconds) is scoped to a follow-up PR to keep this one reviewable.Fixes #88