@baixfeng/godot-mcp-cli 1.0.11

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.
Files changed (115) hide show
  1. package/README.md +187 -0
  2. package/addons/godot_mcp/command_handler.gd +161 -0
  3. package/addons/godot_mcp/command_handler.gd.uid +1 -0
  4. package/addons/godot_mcp/commands/base_command_processor.gd +221 -0
  5. package/addons/godot_mcp/commands/base_command_processor.gd.uid +1 -0
  6. package/addons/godot_mcp/commands/debugger_commands.gd +221 -0
  7. package/addons/godot_mcp/commands/debugger_commands.gd.uid +1 -0
  8. package/addons/godot_mcp/commands/editor_commands.gd +237 -0
  9. package/addons/godot_mcp/commands/editor_commands.gd.uid +1 -0
  10. package/addons/godot_mcp/commands/editor_script_commands.gd +365 -0
  11. package/addons/godot_mcp/commands/editor_script_commands.gd.uid +1 -0
  12. package/addons/godot_mcp/commands/input_commands.gd +337 -0
  13. package/addons/godot_mcp/commands/input_commands.gd.uid +1 -0
  14. package/addons/godot_mcp/commands/node_commands.gd +222 -0
  15. package/addons/godot_mcp/commands/node_commands.gd.uid +1 -0
  16. package/addons/godot_mcp/commands/project_commands.gd +298 -0
  17. package/addons/godot_mcp/commands/project_commands.gd.uid +1 -0
  18. package/addons/godot_mcp/commands/scene_commands.gd +337 -0
  19. package/addons/godot_mcp/commands/scene_commands.gd.uid +1 -0
  20. package/addons/godot_mcp/commands/script_commands.gd +349 -0
  21. package/addons/godot_mcp/commands/script_commands.gd.uid +1 -0
  22. package/addons/godot_mcp/mcp_asset_commands.gd +153 -0
  23. package/addons/godot_mcp/mcp_asset_commands.gd.uid +1 -0
  24. package/addons/godot_mcp/mcp_debug_output_publisher.gd +1669 -0
  25. package/addons/godot_mcp/mcp_debug_output_publisher.gd.uid +1 -0
  26. package/addons/godot_mcp/mcp_debugger_bridge.gd +1455 -0
  27. package/addons/godot_mcp/mcp_debugger_bridge.gd.uid +1 -0
  28. package/addons/godot_mcp/mcp_enhanced_commands.gd +1083 -0
  29. package/addons/godot_mcp/mcp_enhanced_commands.gd.uid +1 -0
  30. package/addons/godot_mcp/mcp_input_handler.gd +545 -0
  31. package/addons/godot_mcp/mcp_input_handler.gd.uid +1 -0
  32. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd +464 -0
  33. package/addons/godot_mcp/mcp_runtime_debugger_bridge.gd.uid +1 -0
  34. package/addons/godot_mcp/mcp_script_resource_commands.gd +165 -0
  35. package/addons/godot_mcp/mcp_script_resource_commands.gd.uid +1 -0
  36. package/addons/godot_mcp/mcp_server.gd +260 -0
  37. package/addons/godot_mcp/mcp_server.gd.uid +1 -0
  38. package/addons/godot_mcp/plugin.cfg +7 -0
  39. package/addons/godot_mcp/runtime_debugger.gd +81 -0
  40. package/addons/godot_mcp/runtime_debugger.gd.uid +1 -0
  41. package/addons/godot_mcp/ui/mcp_panel.gd +94 -0
  42. package/addons/godot_mcp/ui/mcp_panel.gd.uid +1 -0
  43. package/addons/godot_mcp/ui/mcp_panel.tscn +96 -0
  44. package/addons/godot_mcp/utils/node_utils.gd +82 -0
  45. package/addons/godot_mcp/utils/node_utils.gd.uid +1 -0
  46. package/addons/godot_mcp/utils/resource_utils.gd +81 -0
  47. package/addons/godot_mcp/utils/resource_utils.gd.uid +1 -0
  48. package/addons/godot_mcp/utils/script_utils.gd +114 -0
  49. package/addons/godot_mcp/utils/script_utils.gd.uid +1 -0
  50. package/addons/godot_mcp/websocket_server.gd +197 -0
  51. package/addons/godot_mcp/websocket_server.gd.uid +1 -0
  52. package/dist/cli.d.ts +2 -0
  53. package/dist/cli.js +561 -0
  54. package/dist/cli.js.map +1 -0
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.js +156 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/resources/asset_resources.d.ts +29 -0
  59. package/dist/resources/asset_resources.js +145 -0
  60. package/dist/resources/asset_resources.js.map +1 -0
  61. package/dist/resources/debug_resources.d.ts +11 -0
  62. package/dist/resources/debug_resources.js +106 -0
  63. package/dist/resources/debug_resources.js.map +1 -0
  64. package/dist/resources/debugger_resources.d.ts +62 -0
  65. package/dist/resources/debugger_resources.js +201 -0
  66. package/dist/resources/debugger_resources.js.map +1 -0
  67. package/dist/resources/editor_resources.d.ts +47 -0
  68. package/dist/resources/editor_resources.js +155 -0
  69. package/dist/resources/editor_resources.js.map +1 -0
  70. package/dist/resources/project_resources.d.ts +33 -0
  71. package/dist/resources/project_resources.js +137 -0
  72. package/dist/resources/project_resources.js.map +1 -0
  73. package/dist/resources/scene_resources.d.ts +33 -0
  74. package/dist/resources/scene_resources.js +160 -0
  75. package/dist/resources/scene_resources.js.map +1 -0
  76. package/dist/resources/script_resources.d.ts +51 -0
  77. package/dist/resources/script_resources.js +203 -0
  78. package/dist/resources/script_resources.js.map +1 -0
  79. package/dist/tools/asset_tools.d.ts +5 -0
  80. package/dist/tools/asset_tools.js +125 -0
  81. package/dist/tools/asset_tools.js.map +1 -0
  82. package/dist/tools/debugger_tools.d.ts +2 -0
  83. package/dist/tools/debugger_tools.js +342 -0
  84. package/dist/tools/debugger_tools.js.map +1 -0
  85. package/dist/tools/editor_tools.d.ts +2 -0
  86. package/dist/tools/editor_tools.js +165 -0
  87. package/dist/tools/editor_tools.js.map +1 -0
  88. package/dist/tools/enhanced_tools.d.ts +5 -0
  89. package/dist/tools/enhanced_tools.js +706 -0
  90. package/dist/tools/enhanced_tools.js.map +1 -0
  91. package/dist/tools/input_tools.d.ts +2 -0
  92. package/dist/tools/input_tools.js +408 -0
  93. package/dist/tools/input_tools.js.map +1 -0
  94. package/dist/tools/node_tools.d.ts +5 -0
  95. package/dist/tools/node_tools.js +217 -0
  96. package/dist/tools/node_tools.js.map +1 -0
  97. package/dist/tools/project_tools.d.ts +5 -0
  98. package/dist/tools/project_tools.js +162 -0
  99. package/dist/tools/project_tools.js.map +1 -0
  100. package/dist/tools/scene_tools.d.ts +5 -0
  101. package/dist/tools/scene_tools.js +260 -0
  102. package/dist/tools/scene_tools.js.map +1 -0
  103. package/dist/tools/script_resource_tools.d.ts +5 -0
  104. package/dist/tools/script_resource_tools.js +5 -0
  105. package/dist/tools/script_resource_tools.js.map +1 -0
  106. package/dist/tools/script_tools.d.ts +5 -0
  107. package/dist/tools/script_tools.js +154 -0
  108. package/dist/tools/script_tools.js.map +1 -0
  109. package/dist/utils/godot_connection.d.ts +30 -0
  110. package/dist/utils/godot_connection.js +285 -0
  111. package/dist/utils/godot_connection.js.map +1 -0
  112. package/dist/utils/types.d.ts +16 -0
  113. package/dist/utils/types.js +2 -0
  114. package/dist/utils/types.js.map +1 -0
  115. package/package.json +58 -0
@@ -0,0 +1,342 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
38
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39
+ if (ar || !(i in from)) {
40
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
41
+ ar[i] = from[i];
42
+ }
43
+ }
44
+ return to.concat(ar || Array.prototype.slice.call(from));
45
+ };
46
+ import { z } from 'zod';
47
+ import { getGodotConnection } from '../utils/godot_connection.js';
48
+ var createSimpleDebuggerTool = function (config) { return ({
49
+ name: config.name,
50
+ description: config.description,
51
+ parameters: config.parameters,
52
+ execute: function (params) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var godot, safeParams, payload, result, error_1;
54
+ var _a;
55
+ return __generator(this, function (_b) {
56
+ switch (_b.label) {
57
+ case 0:
58
+ godot = getGodotConnection();
59
+ safeParams = (params !== null && params !== void 0 ? params : {});
60
+ payload = config.transformParams
61
+ ? config.transformParams(safeParams)
62
+ : safeParams;
63
+ _b.label = 1;
64
+ case 1:
65
+ _b.trys.push([1, 3, , 4]);
66
+ return [4 /*yield*/, godot.sendCommand(config.command, payload)];
67
+ case 2:
68
+ result = _b.sent();
69
+ if ((result === null || result === void 0 ? void 0 : result.success) === false) {
70
+ throw new Error((_a = result.message) !== null && _a !== void 0 ? _a : "Failed to ".concat(config.errorContext));
71
+ }
72
+ return [2 /*return*/, config.successMessage(safeParams, result)];
73
+ case 3:
74
+ error_1 = _b.sent();
75
+ throw new Error("Failed to ".concat(config.errorContext, ": ").concat(error_1.message));
76
+ case 4: return [2 /*return*/];
77
+ }
78
+ });
79
+ }); },
80
+ }); };
81
+ var formatBreakpointList = function (result) {
82
+ if (!result.breakpoints) {
83
+ return 'No breakpoints information available';
84
+ }
85
+ var lines = ['Current breakpoints:'];
86
+ for (var _i = 0, _a = Object.entries(result.breakpoints); _i < _a.length; _i++) {
87
+ var _b = _a[_i], scriptPath = _b[0], breakpointLines = _b[1];
88
+ if (Array.isArray(breakpointLines) && breakpointLines.length > 0) {
89
+ lines.push("- ".concat(scriptPath, ": ").concat(breakpointLines.map(function (line) { return "line ".concat(line); }).join(', ')));
90
+ }
91
+ }
92
+ if (lines.length === 1) {
93
+ lines.push('No breakpoints set');
94
+ }
95
+ return lines.join('\n');
96
+ };
97
+ var formatDebuggerState = function (state) {
98
+ var _a, _b, _c;
99
+ var lines = ['Debugger State:'];
100
+ lines.push("- Active: ".concat(state.debugger_active ? 'Yes' : 'No'));
101
+ if (Array.isArray(state.active_sessions) && state.active_sessions.length > 0) {
102
+ lines.push("- Active Sessions (IDs): ".concat(state.active_sessions.join(', ')));
103
+ lines.push("- Session Count: ".concat(state.active_sessions.length));
104
+ lines.push("- Current Session: ".concat((_a = state.current_session_id) !== null && _a !== void 0 ? _a : 'None'));
105
+ lines.push("- Paused: ".concat(state.paused ? 'Yes' : 'No'));
106
+ lines.push("- Total Breakpoints: ".concat((_b = state.total_breakpoints) !== null && _b !== void 0 ? _b : 0));
107
+ if (state.current_script && typeof state.current_line === 'number' && state.current_line >= 0) {
108
+ lines.push("- Current Location: ".concat(state.current_script, ":").concat(state.current_line));
109
+ }
110
+ }
111
+ else {
112
+ lines.push('- No active debug sessions');
113
+ }
114
+ if (state.diagnostics) {
115
+ var diag = state.diagnostics;
116
+ var rawSessionObjects = diag['godot_session_objects'];
117
+ if (Array.isArray(rawSessionObjects)) {
118
+ var sessionSummaries = rawSessionObjects
119
+ .map(function (info) {
120
+ var _a;
121
+ var id = (_a = info['id']) !== null && _a !== void 0 ? _a : '?';
122
+ var active = info['active'] ? 'active' : 'inactive';
123
+ var paused = info['breaked'] ? 'paused' : 'running';
124
+ return "#".concat(id, " (").concat(active, ", ").concat(paused, ")");
125
+ });
126
+ lines.push("- Godot Sessions (".concat((_c = diag['godot_session_count']) !== null && _c !== void 0 ? _c : 0, "): ").concat(sessionSummaries.length > 0 ? sessionSummaries.join('; ') : 'none detected'));
127
+ }
128
+ if (Array.isArray(diag['tracked_sessions'])) {
129
+ var tracked = diag['tracked_sessions'].map(function (id) { return String(id); });
130
+ lines.push("- Tracked Session IDs: ".concat(tracked.length > 0 ? tracked.join(', ') : 'none'));
131
+ }
132
+ }
133
+ return lines.join('\n');
134
+ };
135
+ var emptyParamsSchema = z.object({});
136
+ export var debuggerTools = [
137
+ createSimpleDebuggerTool({
138
+ name: 'debugger_set_breakpoint',
139
+ description: 'Sets a breakpoint at a specific line in a script',
140
+ command: 'debugger_set_breakpoint',
141
+ parameters: z.object({
142
+ script_path: z.string()
143
+ .describe('The path to the script file (absolute or relative to res://)'),
144
+ line: z.number()
145
+ .int()
146
+ .min(0)
147
+ .describe('The line number where to set the breakpoint'),
148
+ }),
149
+ successMessage: function (_a) {
150
+ var script_path = _a.script_path, line = _a.line;
151
+ return "Breakpoint set successfully at ".concat(script_path, ":").concat(line);
152
+ },
153
+ errorContext: 'set breakpoint',
154
+ }),
155
+ createSimpleDebuggerTool({
156
+ name: 'debugger_remove_breakpoint',
157
+ description: 'Removes a breakpoint at a specific line in a script',
158
+ command: 'debugger_remove_breakpoint',
159
+ parameters: z.object({
160
+ script_path: z.string()
161
+ .describe('The path to the script file (absolute or relative to res://)'),
162
+ line: z.number()
163
+ .int()
164
+ .min(0)
165
+ .describe('The line number where to remove the breakpoint'),
166
+ }),
167
+ successMessage: function (_a) {
168
+ var script_path = _a.script_path, line = _a.line;
169
+ return "Breakpoint removed successfully from ".concat(script_path, ":").concat(line);
170
+ },
171
+ errorContext: 'remove breakpoint',
172
+ }),
173
+ {
174
+ name: 'debugger_get_breakpoints',
175
+ description: 'Gets all currently set breakpoints',
176
+ parameters: emptyParamsSchema,
177
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
178
+ var godot, result, error_2;
179
+ return __generator(this, function (_a) {
180
+ switch (_a.label) {
181
+ case 0:
182
+ godot = getGodotConnection();
183
+ _a.label = 1;
184
+ case 1:
185
+ _a.trys.push([1, 3, , 4]);
186
+ return [4 /*yield*/, godot.sendCommand('debugger_get_breakpoints', {})];
187
+ case 2:
188
+ result = _a.sent();
189
+ return [2 /*return*/, formatBreakpointList(result)];
190
+ case 3:
191
+ error_2 = _a.sent();
192
+ throw new Error("Failed to get breakpoints: ".concat(error_2.message));
193
+ case 4: return [2 /*return*/];
194
+ }
195
+ });
196
+ }); },
197
+ },
198
+ createSimpleDebuggerTool({
199
+ name: 'debugger_clear_all_breakpoints',
200
+ description: 'Clears all breakpoints',
201
+ command: 'debugger_clear_all_breakpoints',
202
+ parameters: emptyParamsSchema,
203
+ successMessage: function () { return 'All breakpoints cleared successfully'; },
204
+ errorContext: 'clear breakpoints',
205
+ }),
206
+ createSimpleDebuggerTool({
207
+ name: 'debugger_pause_execution',
208
+ description: 'Pauses the execution of the running project',
209
+ command: 'debugger_pause_execution',
210
+ parameters: emptyParamsSchema,
211
+ successMessage: function () { return 'Execution paused successfully'; },
212
+ errorContext: 'pause execution',
213
+ }),
214
+ createSimpleDebuggerTool({
215
+ name: 'debugger_resume_execution',
216
+ description: 'Resumes the execution of the paused project',
217
+ command: 'debugger_resume_execution',
218
+ parameters: emptyParamsSchema,
219
+ successMessage: function () { return 'Execution resumed successfully'; },
220
+ errorContext: 'resume execution',
221
+ }),
222
+ createSimpleDebuggerTool({
223
+ name: 'debugger_step_over',
224
+ description: 'Steps over the current line of code',
225
+ command: 'debugger_step_over',
226
+ parameters: emptyParamsSchema,
227
+ successMessage: function () { return 'Step over executed successfully'; },
228
+ errorContext: 'step over',
229
+ }),
230
+ createSimpleDebuggerTool({
231
+ name: 'debugger_step_into',
232
+ description: 'Steps into the current function call',
233
+ command: 'debugger_step_into',
234
+ parameters: emptyParamsSchema,
235
+ successMessage: function () { return 'Step into executed successfully'; },
236
+ errorContext: 'step into',
237
+ }),
238
+ {
239
+ name: 'debugger_get_call_stack',
240
+ description: 'Gets the current call stack',
241
+ parameters: z.object({
242
+ session_id: z.number()
243
+ .int()
244
+ .optional()
245
+ .describe('Optional debug session ID (will use active session if not provided)'),
246
+ }),
247
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
248
+ var godot, params, result, frames_1, lines, error_3;
249
+ var session_id = _b.session_id;
250
+ return __generator(this, function (_c) {
251
+ switch (_c.label) {
252
+ case 0:
253
+ godot = getGodotConnection();
254
+ _c.label = 1;
255
+ case 1:
256
+ _c.trys.push([1, 3, , 4]);
257
+ params = session_id !== undefined ? { session_id: session_id } : {};
258
+ return [4 /*yield*/, godot.sendCommand('debugger_get_call_stack', params)];
259
+ case 2:
260
+ result = _c.sent();
261
+ if (result.error) {
262
+ throw new Error(result.error);
263
+ }
264
+ frames_1 = Array.isArray(result.frames) ? result.frames : [];
265
+ if (frames_1.length === 0) {
266
+ return [2 /*return*/, 'Call stack is empty.'];
267
+ }
268
+ lines = frames_1.map(function (frame, index) {
269
+ var idx = typeof frame.index === 'number' ? frame.index : index;
270
+ var fn = typeof frame.function === 'string' && frame.function.length > 0
271
+ ? frame.function
272
+ : '(anonymous)';
273
+ var script = typeof frame.script === 'string' && frame.script.length > 0
274
+ ? frame.script
275
+ : (typeof frame.file === 'string' ? frame.file : '');
276
+ var lineNumber = typeof frame.line === 'number' ? frame.line : -1;
277
+ var location = script;
278
+ if (lineNumber >= 0) {
279
+ location = location.length > 0 ? "".concat(location, ":").concat(lineNumber) : ":".concat(lineNumber);
280
+ }
281
+ if (location.length === 0 && typeof frame.location === 'string' && frame.location.length > 0) {
282
+ location = frame.location;
283
+ }
284
+ if (location.length === 0) {
285
+ location = 'location unavailable';
286
+ }
287
+ return "#".concat(idx, " ").concat(fn, " \u2014 ").concat(location);
288
+ });
289
+ return [2 /*return*/, __spreadArray([
290
+ "Captured ".concat(frames_1.length, " frame(s)").concat(result.session_id !== undefined ? " (session ".concat(result.session_id, ")") : '', ".")
291
+ ], lines, true).join('\n')];
292
+ case 3:
293
+ error_3 = _c.sent();
294
+ throw new Error("Failed to get call stack: ".concat(error_3.message));
295
+ case 4: return [2 /*return*/];
296
+ }
297
+ });
298
+ }); },
299
+ },
300
+ {
301
+ name: 'debugger_get_current_state',
302
+ description: 'Gets the current state of the debugger',
303
+ parameters: emptyParamsSchema,
304
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
305
+ var godot, result, error_4;
306
+ return __generator(this, function (_a) {
307
+ switch (_a.label) {
308
+ case 0:
309
+ godot = getGodotConnection();
310
+ _a.label = 1;
311
+ case 1:
312
+ _a.trys.push([1, 3, , 4]);
313
+ return [4 /*yield*/, godot.sendCommand('debugger_get_current_state', {})];
314
+ case 2:
315
+ result = _a.sent();
316
+ return [2 /*return*/, formatDebuggerState(result)];
317
+ case 3:
318
+ error_4 = _a.sent();
319
+ throw new Error("Failed to get debugger state: ".concat(error_4.message));
320
+ case 4: return [2 /*return*/];
321
+ }
322
+ });
323
+ }); },
324
+ },
325
+ createSimpleDebuggerTool({
326
+ name: 'debugger_enable_events',
327
+ description: 'Enables debugger events for this client (required for breakpoint notifications)',
328
+ command: 'debugger_enable_events',
329
+ parameters: emptyParamsSchema,
330
+ successMessage: function (_, result) { return "Debugger events enabled for client ".concat(result.client_id, ". You will now receive notifications for breakpoints and execution changes."); },
331
+ errorContext: 'enable debugger events',
332
+ }),
333
+ createSimpleDebuggerTool({
334
+ name: 'debugger_disable_events',
335
+ description: 'Disables debugger events for this client',
336
+ command: 'debugger_disable_events',
337
+ parameters: emptyParamsSchema,
338
+ successMessage: function (_, result) { return "Debugger events disabled for client ".concat(result.client_id); },
339
+ errorContext: 'disable debugger events',
340
+ }),
341
+ ];
342
+ //# sourceMappingURL=debugger_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debugger_tools.js","sourceRoot":"","sources":["../../src/tools/debugger_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAiClE,IAAM,wBAAwB,GAAG,UAAI,MAAmC,IAAiB,OAAA,CAAC;IACxF,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,WAAW,EAAE,MAAM,CAAC,WAAW;IAC/B,UAAU,EAAE,MAAM,CAAC,UAAU;IAC7B,OAAO,EAAE,UAAO,MAAS;;;;;;oBACjB,KAAK,GAAG,kBAAkB,EAAE,CAAC;oBAC7B,UAAU,GAAG,CAAC,MAAM,aAAN,MAAM,cAAN,MAAM,GAAK,EAAQ,CAAC,CAAC;oBACnC,OAAO,GAAG,MAAM,CAAC,eAAe;wBACpC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC;wBACpC,CAAC,CAAE,UAAiD,CAAC;;;;oBAGtC,qBAAM,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,EAAA;;oBAAzD,MAAM,GAAG,SAAgD;oBAE/D,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,MAAK,KAAK,EAAE,CAAC;wBAC9B,MAAM,IAAI,KAAK,CAAC,MA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,CAAE,EAAzD,CAAyD;QACxF,YAAY,EAAE,yBAAyB;KACxC,CAAC;CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { MCPTool } from '../utils/types.js';
2
+ export declare const editorTools: MCPTool[];
@@ -0,0 +1,165 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { z } from 'zod';
38
+ import { getGodotConnection } from '../utils/godot_connection.js';
39
+ export var editorTools = [
40
+ {
41
+ name: 'execute_editor_script',
42
+ description: 'Executes arbitrary GDScript code in the Godot editor',
43
+ parameters: z.object({
44
+ code: z.string()
45
+ .describe('GDScript code to execute in the editor context'),
46
+ }),
47
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
48
+ var godot, result, outputText, error_1;
49
+ var code = _b.code;
50
+ return __generator(this, function (_c) {
51
+ switch (_c.label) {
52
+ case 0:
53
+ godot = getGodotConnection();
54
+ _c.label = 1;
55
+ case 1:
56
+ _c.trys.push([1, 3, , 4]);
57
+ return [4 /*yield*/, godot.sendCommand('execute_editor_script', { code: code })];
58
+ case 2:
59
+ result = _c.sent();
60
+ outputText = 'Script executed successfully';
61
+ if (result.output && Array.isArray(result.output) && result.output.length > 0) {
62
+ outputText += '\n\nOutput:\n' + result.output.join('\n');
63
+ }
64
+ if (result.result) {
65
+ outputText += '\n\nResult:\n' + JSON.stringify(result.result, null, 2);
66
+ }
67
+ return [2 /*return*/, outputText];
68
+ case 3:
69
+ error_1 = _c.sent();
70
+ throw new Error("Script execution failed: ".concat(error_1.message));
71
+ case 4: return [2 /*return*/];
72
+ }
73
+ });
74
+ }); },
75
+ },
76
+ {
77
+ name: 'reload_project',
78
+ description: 'Restart the Godot editor to fully reload the project. This will disconnect the MCP connection temporarily.',
79
+ parameters: z.object({
80
+ save: z.boolean()
81
+ .optional()
82
+ .default(true)
83
+ .describe('Whether to save all open scenes before restarting (default: true)'),
84
+ }),
85
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
86
+ var godot, result, error_2;
87
+ var save = _b.save;
88
+ return __generator(this, function (_c) {
89
+ switch (_c.label) {
90
+ case 0:
91
+ godot = getGodotConnection();
92
+ _c.label = 1;
93
+ case 1:
94
+ _c.trys.push([1, 3, , 4]);
95
+ return [4 /*yield*/, godot.sendCommand('reload_project', { save: save !== null && save !== void 0 ? save : true })];
96
+ case 2:
97
+ result = _c.sent();
98
+ return [2 /*return*/, "Godot editor is restarting".concat(save ? ' (saving changes)' : ' (without saving)', ". The MCP connection will be temporarily lost.")];
99
+ case 3:
100
+ error_2 = _c.sent();
101
+ throw new Error("Failed to reload project: ".concat(error_2.message));
102
+ case 4: return [2 /*return*/];
103
+ }
104
+ });
105
+ }); },
106
+ },
107
+ {
108
+ name: 'reload_scene',
109
+ description: 'Reload a scene from disk, discarding any unsaved changes. If no scene path is provided, reloads the currently open scene.',
110
+ parameters: z.object({
111
+ scene_path: z.string()
112
+ .optional()
113
+ .describe('Resource path to the scene to reload (e.g. "res://scenes/main.tscn"). If not provided, reloads the current scene.'),
114
+ }),
115
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
116
+ var godot, result, reloadedPath, error_3;
117
+ var _c, _d;
118
+ var scene_path = _b.scene_path;
119
+ return __generator(this, function (_e) {
120
+ switch (_e.label) {
121
+ case 0:
122
+ godot = getGodotConnection();
123
+ _e.label = 1;
124
+ case 1:
125
+ _e.trys.push([1, 3, , 4]);
126
+ return [4 /*yield*/, godot.sendCommand('reload_scene', { scene_path: scene_path !== null && scene_path !== void 0 ? scene_path : '' })];
127
+ case 2:
128
+ result = _e.sent();
129
+ reloadedPath = (_d = (_c = result === null || result === void 0 ? void 0 : result.scene_path) !== null && _c !== void 0 ? _c : scene_path) !== null && _d !== void 0 ? _d : 'current scene';
130
+ return [2 /*return*/, "Scene reloaded from disk: ".concat(reloadedPath)];
131
+ case 3:
132
+ error_3 = _e.sent();
133
+ throw new Error("Failed to reload scene: ".concat(error_3.message));
134
+ case 4: return [2 /*return*/];
135
+ }
136
+ });
137
+ }); },
138
+ },
139
+ {
140
+ name: 'rescan_filesystem',
141
+ description: 'Rescan the project filesystem to detect external file changes. Use this after adding, removing, or modifying files outside the editor.',
142
+ parameters: z.object({}),
143
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
144
+ var godot, error_4;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0:
148
+ godot = getGodotConnection();
149
+ _a.label = 1;
150
+ case 1:
151
+ _a.trys.push([1, 3, , 4]);
152
+ return [4 /*yield*/, godot.sendCommand('rescan_filesystem')];
153
+ case 2:
154
+ _a.sent();
155
+ return [2 /*return*/, 'Filesystem rescan initiated. The editor will update to reflect any external file changes.'];
156
+ case 3:
157
+ error_4 = _a.sent();
158
+ throw new Error("Failed to rescan filesystem: ".concat(error_4.message));
159
+ case 4: return [2 /*return*/];
160
+ }
161
+ });
162
+ }); },
163
+ },
164
+ ];
165
+ //# sourceMappingURL=editor_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor_tools.js","sourceRoot":"","sources":["../../src/tools/editor_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAelE,MAAM,CAAC,IAAM,WAAW,GAAc;IACpC;QACE,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,sDAAsD;QACnE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;iBACb,QAAQ,CAAC,gDAAgD,CAAC;SAC9D,CAAC;QACF,OAAO,EAAE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BAEnG,MAAM,IAAI,KAAK,CAAC,uCAAiC,OAAe,CAAC,OAAO,CAAE,CAAC,CAAC;;;;aAE/E;KACF;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from '../utils/types.js';
2
+ /**
3
+ * Enhanced tools for more complex operations in Godot
4
+ */
5
+ export declare const enhancedTools: MCPTool[];