@satelliteoflove/godot-mcp 3.7.1 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/command_router.gd +1 -0
- package/addon/command_router.gd.uid +1 -0
- package/addon/commands/animation_commands.gd.uid +1 -0
- package/addon/commands/debug_commands.gd +20 -1
- package/addon/commands/debug_commands.gd.uid +1 -0
- package/addon/commands/game_time_commands.gd +83 -0
- package/addon/commands/game_time_commands.gd.uid +1 -0
- package/addon/commands/node_commands.gd.uid +1 -0
- package/addon/commands/profiler_commands.gd.uid +1 -0
- package/addon/commands/project_commands.gd.uid +1 -0
- package/addon/commands/resource_commands.gd.uid +1 -0
- package/addon/commands/runtime_state_commands.gd.uid +1 -0
- package/addon/commands/scene3d_commands.gd.uid +1 -0
- package/addon/commands/scene_commands.gd.uid +1 -0
- package/addon/commands/screenshot_commands.gd.uid +1 -0
- package/addon/commands/script_commands.gd.uid +1 -0
- package/addon/commands/selection_commands.gd.uid +1 -0
- package/addon/commands/tilemap_commands.gd.uid +1 -0
- package/addon/core/base_command.gd.uid +1 -0
- package/addon/core/mcp_constants.gd.uid +1 -0
- package/addon/core/mcp_debugger_plugin.gd.uid +1 -0
- package/addon/core/mcp_enums.gd.uid +1 -0
- package/addon/core/mcp_logger.gd +1 -1
- package/addon/core/mcp_logger.gd.uid +1 -0
- package/addon/core/mcp_utils.gd.uid +1 -0
- package/addon/game_bridge/mcp_frame_profiler.gd.uid +1 -0
- package/addon/game_bridge/mcp_game_bridge.gd +572 -3
- package/addon/game_bridge/mcp_game_bridge.gd.uid +1 -0
- package/addon/game_bridge/mcp_runtime_state_sampler.gd.uid +1 -0
- package/addon/game_bridge/onscreen.gd.uid +1 -0
- package/addon/plugin.cfg +1 -1
- package/addon/plugin.gd.uid +1 -0
- package/addon/ui/status_panel.gd.uid +1 -0
- package/addon/websocket_server.gd.uid +1 -0
- package/dist/__tests__/tools/editor.test.js +8 -0
- package/dist/__tests__/tools/editor.test.js.map +1 -1
- package/dist/__tests__/tools/game-time.test.d.ts +2 -0
- package/dist/__tests__/tools/game-time.test.d.ts.map +1 -0
- package/dist/__tests__/tools/game-time.test.js +204 -0
- package/dist/__tests__/tools/game-time.test.js.map +1 -0
- package/dist/tools/editor.d.ts +1 -0
- package/dist/tools/editor.d.ts.map +1 -1
- package/dist/tools/editor.js +9 -2
- package/dist/tools/editor.js.map +1 -1
- package/dist/tools/game-time.d.ts +30 -0
- package/dist/tools/game-time.d.ts.map +1 -0
- package/dist/tools/game-time.js +125 -0
- package/dist/tools/game-time.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/input.d.ts +5 -0
- package/dist/tools/input.d.ts.map +1 -1
- package/dist/tools/input.js +1 -1
- package/dist/tools/input.js.map +1 -1
- package/package.json +1 -1
package/addon/command_router.gd
CHANGED
|
@@ -22,6 +22,7 @@ func setup(plugin: EditorPlugin) -> void:
|
|
|
22
22
|
_register_handler(MCPInputCommands.new(), plugin)
|
|
23
23
|
_register_handler(MCPProfilerCommands.new(), plugin)
|
|
24
24
|
_register_handler(MCPRuntimeStateCommands.new(), plugin)
|
|
25
|
+
_register_handler(MCPGameTimeCommands.new(), plugin)
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
func _register_handler(handler: MCPBaseCommand, plugin: EditorPlugin) -> void:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://bhjejek8ivdv8
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://dg4xlid3mi2mi
|
|
@@ -3,6 +3,8 @@ extends MCPBaseCommand
|
|
|
3
3
|
class_name MCPDebugCommands
|
|
4
4
|
|
|
5
5
|
const DEBUG_OUTPUT_TIMEOUT := 5.0
|
|
6
|
+
# Keep in sync with LAUNCH_FROZEN_ENV in mcp_game_bridge.gd.
|
|
7
|
+
const LAUNCH_FROZEN_ENV := "GODOT_MCP_LAUNCH_FROZEN"
|
|
6
8
|
|
|
7
9
|
var _debug_output_result: PackedStringArray = []
|
|
8
10
|
var _debug_output_pending: bool = false
|
|
@@ -21,15 +23,32 @@ func get_commands() -> Dictionary:
|
|
|
21
23
|
|
|
22
24
|
func run_project(params: Dictionary) -> Dictionary:
|
|
23
25
|
var scene_path: String = params.get("scene_path", "")
|
|
26
|
+
var frozen: bool = params.get("frozen", false)
|
|
24
27
|
|
|
25
28
|
MCPLogger.clear()
|
|
26
29
|
|
|
30
|
+
# Launch-frozen: the spawned game inherits the editor's environment, so
|
|
31
|
+
# setting this before play makes the bridge freeze the tree in _ready —
|
|
32
|
+
# before the first process frame. Deterministic, unlike sending a freeze
|
|
33
|
+
# message after the debug session comes up (which races the game's first
|
|
34
|
+
# frames against the agent's latency).
|
|
35
|
+
if frozen:
|
|
36
|
+
OS.set_environment(LAUNCH_FROZEN_ENV, "1")
|
|
37
|
+
|
|
27
38
|
if scene_path.is_empty():
|
|
28
39
|
EditorInterface.play_main_scene()
|
|
29
40
|
else:
|
|
30
41
|
EditorInterface.play_custom_scene(scene_path)
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
if frozen:
|
|
44
|
+
# The child captured its environment at spawn; clear promptly so a
|
|
45
|
+
# manual F5 run doesn't inherit the freeze. Two frames covers a
|
|
46
|
+
# deferred spawn. (Godot has no unset; empty fails the == "1" check.)
|
|
47
|
+
await Engine.get_main_loop().process_frame
|
|
48
|
+
await Engine.get_main_loop().process_frame
|
|
49
|
+
OS.set_environment(LAUNCH_FROZEN_ENV, "")
|
|
50
|
+
|
|
51
|
+
return _success({"frozen": frozen})
|
|
33
52
|
|
|
34
53
|
|
|
35
54
|
func stop_project(_params: Dictionary) -> Dictionary:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://cquyem31g4y4b
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@tool
|
|
2
|
+
extends MCPBaseCommand
|
|
3
|
+
class_name MCPGameTimeCommands
|
|
4
|
+
|
|
5
|
+
# Game-time control relay: freeze / step / step_until / thaw / status execute in
|
|
6
|
+
# the game bridge (see mcp_game_bridge.gd); this side only forwards over the
|
|
7
|
+
# debugger channel and waits. Timeout cascade: a step/step_until request is
|
|
8
|
+
# capped at 20s of game time and the bridge's wall budget returns by 25s, so the
|
|
9
|
+
# 28s relay timeout below fires only if the bridge is gone — and stays under the
|
|
10
|
+
# server's 30s command timeout so errors surface typed instead of generic.
|
|
11
|
+
const BASE_TIMEOUT := 10.0
|
|
12
|
+
const STEP_TIMEOUT := 28.0
|
|
13
|
+
|
|
14
|
+
var _last_error: Dictionary = {}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
func get_commands() -> Dictionary:
|
|
18
|
+
return {
|
|
19
|
+
"game_time_freeze": game_time_freeze,
|
|
20
|
+
"game_time_step": game_time_step,
|
|
21
|
+
"game_time_step_until": game_time_step_until,
|
|
22
|
+
"game_time_thaw": game_time_thaw,
|
|
23
|
+
"game_time_status": game_time_status,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
func game_time_freeze(params: Dictionary) -> Dictionary:
|
|
28
|
+
return await _relay("game_time_freeze", [params], BASE_TIMEOUT)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
func game_time_step(params: Dictionary) -> Dictionary:
|
|
32
|
+
return await _relay("game_time_step", [params], STEP_TIMEOUT)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
func game_time_step_until(params: Dictionary) -> Dictionary:
|
|
36
|
+
return await _relay("game_time_step_until", [params], STEP_TIMEOUT)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
func game_time_thaw(params: Dictionary) -> Dictionary:
|
|
40
|
+
return await _relay("game_time_thaw", [params], BASE_TIMEOUT)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
func game_time_status(params: Dictionary) -> Dictionary:
|
|
44
|
+
return await _relay("game_time_status", [params], BASE_TIMEOUT)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
func _relay(msg_type: String, args: Array, timeout: float) -> Dictionary:
|
|
48
|
+
var response = await _send_and_wait(msg_type, args, timeout)
|
|
49
|
+
if response == null:
|
|
50
|
+
return _last_error
|
|
51
|
+
if response is Dictionary and response.has("error"):
|
|
52
|
+
return _error("GAME_TIME_ERROR", str(response["error"]))
|
|
53
|
+
if response is Dictionary:
|
|
54
|
+
return _success(response)
|
|
55
|
+
return _success({"data": response})
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
func _send_and_wait(msg_type: String, args: Array, timeout: float):
|
|
59
|
+
if not EditorInterface.is_playing_scene():
|
|
60
|
+
_last_error = _error("NOT_RUNNING", "No game is currently running")
|
|
61
|
+
return null
|
|
62
|
+
|
|
63
|
+
var debugger_plugin = _plugin.get_debugger_plugin() if _plugin else null
|
|
64
|
+
if debugger_plugin == null or not debugger_plugin.has_active_session():
|
|
65
|
+
_last_error = _error("NO_SESSION", "No active debug session")
|
|
66
|
+
return null
|
|
67
|
+
|
|
68
|
+
var sent: bool = debugger_plugin.send_game_message(msg_type, args)
|
|
69
|
+
if not sent:
|
|
70
|
+
_last_error = _error("SEND_FAILED", "Failed to send message to game")
|
|
71
|
+
return null
|
|
72
|
+
|
|
73
|
+
var start_time := Time.get_ticks_msec()
|
|
74
|
+
while not debugger_plugin.has_response(msg_type):
|
|
75
|
+
await Engine.get_main_loop().process_frame
|
|
76
|
+
if (Time.get_ticks_msec() - start_time) / 1000.0 > timeout:
|
|
77
|
+
debugger_plugin.clear_response(msg_type)
|
|
78
|
+
_last_error = _error("TIMEOUT", "Timed out waiting for %s response" % msg_type)
|
|
79
|
+
return null
|
|
80
|
+
|
|
81
|
+
var response = debugger_plugin.get_response(msg_type)
|
|
82
|
+
debugger_plugin.clear_response(msg_type)
|
|
83
|
+
return response
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://c2pfjqe2yv0c4
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://bke2rvqtw381m
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://c17gnisv1uqju
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://es4uegishf00
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://yts2tlf0btx5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://bns7tsagruukm
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://cniw11jpk5y82
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://ngt4k3u88sj3
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://c578gd4ovecgt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://b1om27ef4rvws
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://ciy2n67gqdsla
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://cietp5vxfv072
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://cwqpmprsn6g2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://hkoghrp3us8j
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://daogurpabpiap
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://b1yx7jiol72rg
|
package/addon/core/mcp_logger.gd
CHANGED
|
@@ -34,7 +34,7 @@ func _log_error(function: String, file: String, line: int, code: String,
|
|
|
34
34
|
for backtrace in script_backtraces:
|
|
35
35
|
for i in backtrace.get_frame_count():
|
|
36
36
|
frames.append({
|
|
37
|
-
"file": backtrace.
|
|
37
|
+
"file": backtrace.get_frame_file(i),
|
|
38
38
|
"line": backtrace.get_frame_line(i),
|
|
39
39
|
"function": backtrace.get_frame_function(i),
|
|
40
40
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://yv8gf1cuf48v
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://dckosaj3snxdo
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
uid://cihxpb547p4du
|