@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,260 @@
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
+ /**
40
+ * Definition for scene tools - operations that manipulate Godot scenes
41
+ */
42
+ export var sceneTools = [
43
+ {
44
+ name: 'create_scene',
45
+ description: 'Create a new empty scene with optional root node type',
46
+ parameters: z.object({
47
+ path: z.string()
48
+ .describe('Path where the new scene will be saved (e.g. "res://scenes/new_scene.tscn")'),
49
+ root_node_type: z.string().optional()
50
+ .describe('Type of root node to create (e.g. "Node2D", "Node3D", "Control"). Defaults to "Node" if not specified'),
51
+ }),
52
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
53
+ var godot, result, error_1;
54
+ var path = _b.path, _c = _b.root_node_type, root_node_type = _c === void 0 ? "Node" : _c;
55
+ return __generator(this, function (_d) {
56
+ switch (_d.label) {
57
+ case 0:
58
+ godot = getGodotConnection();
59
+ _d.label = 1;
60
+ case 1:
61
+ _d.trys.push([1, 3, , 4]);
62
+ return [4 /*yield*/, godot.sendCommand('create_scene', { path: path, root_node_type: root_node_type })];
63
+ case 2:
64
+ result = _d.sent();
65
+ return [2 /*return*/, "Created new scene at ".concat(result.scene_path, " with root node type ").concat(result.root_node_type)];
66
+ case 3:
67
+ error_1 = _d.sent();
68
+ throw new Error("Failed to create scene: ".concat(error_1.message));
69
+ case 4: return [2 /*return*/];
70
+ }
71
+ });
72
+ }); },
73
+ },
74
+ {
75
+ name: 'delete_scene',
76
+ description: 'Delete a scene file from the project',
77
+ parameters: z.object({
78
+ path: z.string()
79
+ .describe('Path to the scene file to delete (e.g. "res://scenes/old_scene.tscn")'),
80
+ }),
81
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
82
+ var godot, result, error_2;
83
+ var path = _b.path;
84
+ return __generator(this, function (_c) {
85
+ switch (_c.label) {
86
+ case 0:
87
+ godot = getGodotConnection();
88
+ _c.label = 1;
89
+ case 1:
90
+ _c.trys.push([1, 3, , 4]);
91
+ return [4 /*yield*/, godot.sendCommand('delete_scene', { path: path })];
92
+ case 2:
93
+ result = _c.sent();
94
+ return [2 /*return*/, "Deleted scene at ".concat(result.scene_path)];
95
+ case 3:
96
+ error_2 = _c.sent();
97
+ throw new Error("Failed to delete scene: ".concat(error_2.message));
98
+ case 4: return [2 /*return*/];
99
+ }
100
+ });
101
+ }); },
102
+ },
103
+ {
104
+ name: 'save_scene',
105
+ description: 'Save the current scene to disk',
106
+ parameters: z.object({
107
+ path: z.string().optional()
108
+ .describe('Path where the scene will be saved (e.g. "res://scenes/main.tscn"). If not provided, uses current scene path.'),
109
+ }),
110
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
111
+ var godot, result, error_3;
112
+ var path = _b.path;
113
+ return __generator(this, function (_c) {
114
+ switch (_c.label) {
115
+ case 0:
116
+ godot = getGodotConnection();
117
+ _c.label = 1;
118
+ case 1:
119
+ _c.trys.push([1, 3, , 4]);
120
+ return [4 /*yield*/, godot.sendCommand('save_scene', { path: path })];
121
+ case 2:
122
+ result = _c.sent();
123
+ return [2 /*return*/, "Saved scene to ".concat(result.scene_path)];
124
+ case 3:
125
+ error_3 = _c.sent();
126
+ throw new Error("Failed to save scene: ".concat(error_3.message));
127
+ case 4: return [2 /*return*/];
128
+ }
129
+ });
130
+ }); },
131
+ },
132
+ {
133
+ name: 'open_scene',
134
+ description: 'Open a scene in the editor',
135
+ parameters: z.object({
136
+ path: z.string()
137
+ .describe('Path to the scene file to open (e.g. "res://scenes/main.tscn")'),
138
+ }),
139
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
140
+ var godot, result, error_4;
141
+ var path = _b.path;
142
+ return __generator(this, function (_c) {
143
+ switch (_c.label) {
144
+ case 0:
145
+ godot = getGodotConnection();
146
+ _c.label = 1;
147
+ case 1:
148
+ _c.trys.push([1, 3, , 4]);
149
+ return [4 /*yield*/, godot.sendCommand('open_scene', { path: path })];
150
+ case 2:
151
+ result = _c.sent();
152
+ return [2 /*return*/, "Opened scene at ".concat(result.scene_path)];
153
+ case 3:
154
+ error_4 = _c.sent();
155
+ throw new Error("Failed to open scene: ".concat(error_4.message));
156
+ case 4: return [2 /*return*/];
157
+ }
158
+ });
159
+ }); },
160
+ },
161
+ {
162
+ name: 'get_current_scene',
163
+ description: 'Get information about the currently open scene',
164
+ parameters: z.object({}),
165
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
166
+ var godot, result, error_5;
167
+ return __generator(this, function (_a) {
168
+ switch (_a.label) {
169
+ case 0:
170
+ godot = getGodotConnection();
171
+ _a.label = 1;
172
+ case 1:
173
+ _a.trys.push([1, 3, , 4]);
174
+ return [4 /*yield*/, godot.sendCommand('get_current_scene', {})];
175
+ case 2:
176
+ result = _a.sent();
177
+ return [2 /*return*/, "Current scene: ".concat(result.scene_path, "\nRoot node: ").concat(result.root_node_name, " (").concat(result.root_node_type, ")")];
178
+ case 3:
179
+ error_5 = _a.sent();
180
+ throw new Error("Failed to get current scene: ".concat(error_5.message));
181
+ case 4: return [2 /*return*/];
182
+ }
183
+ });
184
+ }); },
185
+ },
186
+ {
187
+ name: 'get_project_info',
188
+ description: 'Get information about the current Godot project',
189
+ parameters: z.object({}),
190
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
191
+ var godot, result, godotVersion, output, error_6;
192
+ return __generator(this, function (_a) {
193
+ switch (_a.label) {
194
+ case 0:
195
+ godot = getGodotConnection();
196
+ _a.label = 1;
197
+ case 1:
198
+ _a.trys.push([1, 3, , 4]);
199
+ return [4 /*yield*/, godot.sendCommand('get_project_info', {})];
200
+ case 2:
201
+ result = _a.sent();
202
+ godotVersion = "".concat(result.godot_version.major, ".").concat(result.godot_version.minor, ".").concat(result.godot_version.patch);
203
+ output = "Project Name: ".concat(result.project_name, "\n");
204
+ output += "Project Version: ".concat(result.project_version, "\n");
205
+ output += "Project Path: ".concat(result.project_path, "\n");
206
+ output += "Godot Version: ".concat(godotVersion, "\n");
207
+ if (result.current_scene) {
208
+ output += "Current Scene: ".concat(result.current_scene);
209
+ }
210
+ else {
211
+ output += "No scene is currently open";
212
+ }
213
+ return [2 /*return*/, output];
214
+ case 3:
215
+ error_6 = _a.sent();
216
+ throw new Error("Failed to get project info: ".concat(error_6.message));
217
+ case 4: return [2 /*return*/];
218
+ }
219
+ });
220
+ }); },
221
+ },
222
+ {
223
+ name: 'create_resource',
224
+ description: 'Create a new resource in the project',
225
+ parameters: z.object({
226
+ resource_type: z.string()
227
+ .describe('Type of resource to create (e.g. "ImageTexture", "AudioStreamMP3", "StyleBoxFlat")'),
228
+ resource_path: z.string()
229
+ .describe('Path where the resource will be saved (e.g. "res://resources/style.tres")'),
230
+ properties: z.record(z.string(), z.any()).optional()
231
+ .describe('Dictionary of property values to set on the resource'),
232
+ }),
233
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
234
+ var godot, result, error_7;
235
+ var resource_type = _b.resource_type, resource_path = _b.resource_path, _c = _b.properties, properties = _c === void 0 ? {} : _c;
236
+ return __generator(this, function (_d) {
237
+ switch (_d.label) {
238
+ case 0:
239
+ godot = getGodotConnection();
240
+ _d.label = 1;
241
+ case 1:
242
+ _d.trys.push([1, 3, , 4]);
243
+ return [4 /*yield*/, godot.sendCommand('create_resource', {
244
+ resource_type: resource_type,
245
+ resource_path: resource_path,
246
+ properties: properties,
247
+ })];
248
+ case 2:
249
+ result = _d.sent();
250
+ return [2 /*return*/, "Created ".concat(resource_type, " resource at ").concat(result.resource_path)];
251
+ case 3:
252
+ error_7 = _d.sent();
253
+ throw new Error("Failed to create resource: ".concat(error_7.message));
254
+ case 4: return [2 /*return*/];
255
+ }
256
+ });
257
+ }); },
258
+ },
259
+ ];
260
+ //# sourceMappingURL=scene_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene_tools.js","sourceRoot":"","sources":["../../src/tools/scene_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AA6BlE;;GAEG;AACH,MAAM,CAAC,IAAM,UAAU,GAAc;IACnC;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,uDAAuD;QACpE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;iBACb,QAAQ,CAAC,6EAA6E,CAAC;YAC1F,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;iBAClC,QAAQ,CAAC,uGAAuG,CAAC;SACrH,CAAC;QACF,OAAO,EAAE,iEAAO,EAAoD;;gBAAlD,IAAI,UAAA,EAAE,sBAAuB,EAAvB,cAAc,mBAAG,MAAM,KAAA;;;;wBACvC,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAGlB,qBAAM,KAAK,CAAC,WAAW,CAAgB,cAAc,EAAE,EAAE,IAAI,MAAA,EAAE,cAAc,gBAAA,EAAE,CAAC,EA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AAC;SACpE,CAAC;QACF,OAAO,EAAE,iEAAO,EAAuE;;gBAArE,aAAa,mBAAA,EAAE,aAAa,mBAAA,EAAE,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA;;;;wBACvD,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAGlB,qBAAM,KAAK,CAAC,WAAW,CAAgB,iBAAiB,EAAE;gCACvE,aAAa,eAAA;gCACb,aAAa,eAAA;gCACb,UAAU,YAAA;6BACX,CAAC,EAAA;;wBAJI,MAAM,GAAG,SAIb;wBAEF,sBAAO,kBAAW,aAAa,0BAAgB,MAAM,CAAC,aAAa,CAAE,EAAC;;;wBAEtE,MAAM,IAAI,KAAK,CAAC,qCAA+B,OAAe,CAAC,OAAO,CAAE,CAAC,CAAC;;;;aAE7E;KACF;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from '../utils/types.js';
2
+ /**
3
+ * Tools for script resources in Godot
4
+ */
5
+ export declare const scriptResourceTools: MCPTool[];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Tools for script resources in Godot
3
+ */
4
+ export var scriptResourceTools = [];
5
+ //# sourceMappingURL=script_resource_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script_resource_tools.js","sourceRoot":"","sources":["../../src/tools/script_resource_tools.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,CAAC,IAAM,mBAAmB,GAAc,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from '../utils/types.js';
2
+ /**
3
+ * Definition for script tools - operations that manipulate GDScript files
4
+ */
5
+ export declare const scriptTools: MCPTool[];
@@ -0,0 +1,154 @@
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
+ /**
40
+ * Definition for script tools - operations that manipulate GDScript files
41
+ */
42
+ export var scriptTools = [
43
+ {
44
+ name: 'create_script',
45
+ description: 'Create a new GDScript file in the project',
46
+ parameters: z.object({
47
+ script_path: z.string()
48
+ .describe('Path where the script will be saved (e.g. "res://scripts/player.gd")'),
49
+ content: z.string()
50
+ .describe('Content of the script'),
51
+ node_path: z.string().optional()
52
+ .describe('Path to a node to attach the script to (optional)'),
53
+ }),
54
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
55
+ var godot, result, attachMessage, error_1;
56
+ var script_path = _b.script_path, content = _b.content, node_path = _b.node_path;
57
+ return __generator(this, function (_c) {
58
+ switch (_c.label) {
59
+ case 0:
60
+ godot = getGodotConnection();
61
+ _c.label = 1;
62
+ case 1:
63
+ _c.trys.push([1, 3, , 4]);
64
+ return [4 /*yield*/, godot.sendCommand('create_script', {
65
+ script_path: script_path,
66
+ content: content,
67
+ node_path: node_path,
68
+ })];
69
+ case 2:
70
+ result = _c.sent();
71
+ attachMessage = node_path
72
+ ? " and attached to node at ".concat(node_path)
73
+ : '';
74
+ return [2 /*return*/, "Created script at ".concat(result.script_path).concat(attachMessage)];
75
+ case 3:
76
+ error_1 = _c.sent();
77
+ throw new Error("Failed to create script: ".concat(error_1.message));
78
+ case 4: return [2 /*return*/];
79
+ }
80
+ });
81
+ }); },
82
+ },
83
+ {
84
+ name: 'edit_script',
85
+ description: 'Edit an existing GDScript file',
86
+ parameters: z.object({
87
+ script_path: z.string()
88
+ .describe('Path to the script file to edit (e.g. "res://scripts/player.gd")'),
89
+ content: z.string()
90
+ .describe('New content of the script'),
91
+ }),
92
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
93
+ var godot, error_2;
94
+ var script_path = _b.script_path, content = _b.content;
95
+ return __generator(this, function (_c) {
96
+ switch (_c.label) {
97
+ case 0:
98
+ godot = getGodotConnection();
99
+ _c.label = 1;
100
+ case 1:
101
+ _c.trys.push([1, 3, , 4]);
102
+ return [4 /*yield*/, godot.sendCommand('edit_script', {
103
+ script_path: script_path,
104
+ content: content,
105
+ })];
106
+ case 2:
107
+ _c.sent();
108
+ return [2 /*return*/, "Updated script at ".concat(script_path)];
109
+ case 3:
110
+ error_2 = _c.sent();
111
+ throw new Error("Failed to edit script: ".concat(error_2.message));
112
+ case 4: return [2 /*return*/];
113
+ }
114
+ });
115
+ }); },
116
+ },
117
+ {
118
+ name: 'get_script',
119
+ description: 'Get the content of a GDScript file',
120
+ parameters: z.object({
121
+ script_path: z.string().optional()
122
+ .describe('Path to the script file (e.g. "res://scripts/player.gd")'),
123
+ node_path: z.string().optional()
124
+ .describe('Path to a node with a script attached'),
125
+ }).refine(function (data) { return data.script_path !== undefined || data.node_path !== undefined; }, {
126
+ message: "Either script_path or node_path must be provided",
127
+ }),
128
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
129
+ var godot, result, error_3;
130
+ var script_path = _b.script_path, node_path = _b.node_path;
131
+ return __generator(this, function (_c) {
132
+ switch (_c.label) {
133
+ case 0:
134
+ godot = getGodotConnection();
135
+ _c.label = 1;
136
+ case 1:
137
+ _c.trys.push([1, 3, , 4]);
138
+ return [4 /*yield*/, godot.sendCommand('get_script', {
139
+ script_path: script_path,
140
+ node_path: node_path,
141
+ })];
142
+ case 2:
143
+ result = _c.sent();
144
+ return [2 /*return*/, "Script at ".concat(result.script_path, ":\n\n```gdscript\n").concat(result.content, "\n```")];
145
+ case 3:
146
+ error_3 = _c.sent();
147
+ throw new Error("Failed to get script: ".concat(error_3.message));
148
+ case 4: return [2 /*return*/];
149
+ }
150
+ });
151
+ }); },
152
+ },
153
+ ];
154
+ //# sourceMappingURL=script_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"script_tools.js","sourceRoot":"","sources":["../../src/tools/script_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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,MAAM,CAAC,WAAW,+BAAwB,MAAM,CAAC,OAAO,UAAU,EAAC;;;wBAEvF,MAAM,IAAI,KAAK,CAAC,gCAA0B,OAAe,CAAC,OAAO,CAAE,CAAC,CAAC;;;;aAExE;KACF;CACF,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { EventEmitter } from 'events';
2
+ export interface GodotResponse {
3
+ status: 'success' | 'error';
4
+ result?: any;
5
+ message?: string;
6
+ commandId?: string;
7
+ }
8
+ export interface GodotCommand {
9
+ type: string;
10
+ params: Record<string, any>;
11
+ commandId: string;
12
+ }
13
+ export declare class GodotConnection extends EventEmitter {
14
+ private url;
15
+ private timeout;
16
+ private maxRetries;
17
+ private retryDelay;
18
+ private ws;
19
+ private connected;
20
+ private reconnecting;
21
+ private commandQueue;
22
+ private commandId;
23
+ constructor(url?: string, // Use explicit IP
24
+ timeout?: number, maxRetries?: number, retryDelay?: number);
25
+ connect(): Promise<void>;
26
+ sendCommand<T = any>(type: string, params?: Record<string, any>): Promise<T>;
27
+ disconnect(): void;
28
+ isConnected(): boolean;
29
+ }
30
+ export declare function getGodotConnection(): GodotConnection;