@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,217 @@
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 node tools - operations that manipulate nodes in the scene tree
41
+ */
42
+ export var nodeTools = [
43
+ {
44
+ name: 'create_node',
45
+ description: 'Create a new node in the Godot scene tree',
46
+ parameters: z.object({
47
+ parent_path: z.string()
48
+ .describe('Path to the parent node where the new node will be created (e.g. ".", "./UI")'),
49
+ node_type: z.string()
50
+ .describe('Type of node to create (e.g. "Node2D", "Sprite2D", "Label")'),
51
+ node_name: z.string()
52
+ .describe('Name for the new node'),
53
+ }),
54
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
55
+ var godot, result, error_1;
56
+ var parent_path = _b.parent_path, node_type = _b.node_type, node_name = _b.node_name;
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_node', {
65
+ parent_path: parent_path,
66
+ node_type: node_type,
67
+ node_name: node_name,
68
+ })];
69
+ case 2:
70
+ result = _c.sent();
71
+ return [2 /*return*/, "Created ".concat(node_type, " node named \"").concat(node_name, "\" at ").concat(result.node_path)];
72
+ case 3:
73
+ error_1 = _c.sent();
74
+ throw new Error("Failed to create node: ".concat(error_1.message));
75
+ case 4: return [2 /*return*/];
76
+ }
77
+ });
78
+ }); },
79
+ },
80
+ {
81
+ name: 'delete_node',
82
+ description: 'Delete a node from the Godot scene tree',
83
+ parameters: z.object({
84
+ node_path: z.string()
85
+ .describe('Path to the node to delete (e.g. "./Player")'),
86
+ }),
87
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
88
+ var godot, error_2;
89
+ var node_path = _b.node_path;
90
+ return __generator(this, function (_c) {
91
+ switch (_c.label) {
92
+ case 0:
93
+ godot = getGodotConnection();
94
+ _c.label = 1;
95
+ case 1:
96
+ _c.trys.push([1, 3, , 4]);
97
+ return [4 /*yield*/, godot.sendCommand('delete_node', { node_path: node_path })];
98
+ case 2:
99
+ _c.sent();
100
+ return [2 /*return*/, "Deleted node at ".concat(node_path)];
101
+ case 3:
102
+ error_2 = _c.sent();
103
+ throw new Error("Failed to delete node: ".concat(error_2.message));
104
+ case 4: return [2 /*return*/];
105
+ }
106
+ });
107
+ }); },
108
+ },
109
+ {
110
+ name: 'update_node_property',
111
+ description: 'Update a property of a node in the Godot scene tree',
112
+ parameters: z.object({
113
+ node_path: z.string()
114
+ .describe('Path to the node to update (e.g. "./Player")'),
115
+ property: z.string()
116
+ .describe('Name of the property to update (e.g. "position", "text", "modulate")'),
117
+ value: z.any()
118
+ .describe('New value for the property'),
119
+ }),
120
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
121
+ var godot, result, error_3;
122
+ var node_path = _b.node_path, property = _b.property, value = _b.value;
123
+ return __generator(this, function (_c) {
124
+ switch (_c.label) {
125
+ case 0:
126
+ godot = getGodotConnection();
127
+ _c.label = 1;
128
+ case 1:
129
+ _c.trys.push([1, 3, , 4]);
130
+ return [4 /*yield*/, godot.sendCommand('update_node_property', {
131
+ node_path: node_path,
132
+ property: property,
133
+ value: value,
134
+ })];
135
+ case 2:
136
+ result = _c.sent();
137
+ return [2 /*return*/, "Updated property \"".concat(property, "\" of node at ").concat(node_path, " to ").concat(JSON.stringify(value))];
138
+ case 3:
139
+ error_3 = _c.sent();
140
+ throw new Error("Failed to update node property: ".concat(error_3.message));
141
+ case 4: return [2 /*return*/];
142
+ }
143
+ });
144
+ }); },
145
+ },
146
+ {
147
+ name: 'get_node_properties',
148
+ description: 'Get all properties of a node in the Godot scene tree',
149
+ parameters: z.object({
150
+ node_path: z.string()
151
+ .describe('Path to the node to inspect (e.g. "./Player")'),
152
+ }),
153
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
154
+ var godot, result, formattedProperties, error_4;
155
+ var node_path = _b.node_path;
156
+ return __generator(this, function (_c) {
157
+ switch (_c.label) {
158
+ case 0:
159
+ godot = getGodotConnection();
160
+ _c.label = 1;
161
+ case 1:
162
+ _c.trys.push([1, 3, , 4]);
163
+ return [4 /*yield*/, godot.sendCommand('get_node_properties', { node_path: node_path })];
164
+ case 2:
165
+ result = _c.sent();
166
+ formattedProperties = Object.entries(result.properties)
167
+ .map(function (_a) {
168
+ var key = _a[0], value = _a[1];
169
+ return "".concat(key, ": ").concat(JSON.stringify(value));
170
+ })
171
+ .join('\n');
172
+ return [2 /*return*/, "Properties of node at ".concat(node_path, ":\n\n").concat(formattedProperties)];
173
+ case 3:
174
+ error_4 = _c.sent();
175
+ throw new Error("Failed to get node properties: ".concat(error_4.message));
176
+ case 4: return [2 /*return*/];
177
+ }
178
+ });
179
+ }); },
180
+ },
181
+ {
182
+ name: 'list_nodes',
183
+ description: 'List all child nodes under a parent node in the Godot scene tree',
184
+ parameters: z.object({
185
+ parent_path: z.string()
186
+ .describe('Path to the parent node (e.g. ".", "./UI")'),
187
+ }),
188
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
189
+ var godot, result, formattedChildren, error_5;
190
+ var parent_path = _b.parent_path;
191
+ return __generator(this, function (_c) {
192
+ switch (_c.label) {
193
+ case 0:
194
+ godot = getGodotConnection();
195
+ _c.label = 1;
196
+ case 1:
197
+ _c.trys.push([1, 3, , 4]);
198
+ return [4 /*yield*/, godot.sendCommand('list_nodes', { parent_path: parent_path })];
199
+ case 2:
200
+ result = _c.sent();
201
+ if (result.children.length === 0) {
202
+ return [2 /*return*/, "No child nodes found under ".concat(parent_path)];
203
+ }
204
+ formattedChildren = result.children
205
+ .map(function (child) { return "".concat(child.name, " (").concat(child.type, ") - ").concat(child.path); })
206
+ .join('\n');
207
+ return [2 /*return*/, "Children of node at ".concat(parent_path, ":\n\n").concat(formattedChildren)];
208
+ case 3:
209
+ error_5 = _c.sent();
210
+ throw new Error("Failed to list nodes: ".concat(error_5.message));
211
+ case 4: return [2 /*return*/];
212
+ }
213
+ });
214
+ }); },
215
+ },
216
+ ];
217
+ //# sourceMappingURL=node_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node_tools.js","sourceRoot":"","sources":["../../src/tools/node_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AA8BlE;;GAEG;AACH,MAAM,CAAC,IAAM,SAAS,GAAc;IAClC;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,2CAA2C;QACxD,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC;YACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;iBACpB,QAAQ,CAAC,+EAA+E,CAAC;YAC5F,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;iBAClB,QAAQ,CAAC,6DAA6D,CAAC;YAC1E,SAAS,EAAE,CAAC,CAAC,MAAM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Tools for running and stopping the project or specific scenes from the editor.
4
+ */
5
+ export declare const projectTools: MCPTool[];
@@ -0,0 +1,162 @@
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
+ * Tools for running and stopping the project or specific scenes from the editor.
41
+ */
42
+ export var projectTools = [
43
+ {
44
+ name: 'run_project',
45
+ description: 'Run the project using the configured main scene',
46
+ parameters: z.object({}),
47
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
48
+ var godot, result, scenePath, error_1;
49
+ var _a;
50
+ return __generator(this, function (_b) {
51
+ switch (_b.label) {
52
+ case 0:
53
+ godot = getGodotConnection();
54
+ _b.label = 1;
55
+ case 1:
56
+ _b.trys.push([1, 3, , 4]);
57
+ return [4 /*yield*/, godot.sendCommand('run_project')];
58
+ case 2:
59
+ result = _b.sent();
60
+ scenePath = (_a = result === null || result === void 0 ? void 0 : result.scene_path) !== null && _a !== void 0 ? _a : ProjectRunMessages.unknownScene;
61
+ return [2 /*return*/, "Running project using main scene: ".concat(scenePath)];
62
+ case 3:
63
+ error_1 = _b.sent();
64
+ throw new Error("Failed to run project: ".concat(error_1.message));
65
+ case 4: return [2 /*return*/];
66
+ }
67
+ });
68
+ }); },
69
+ },
70
+ {
71
+ name: 'stop_running_project',
72
+ description: 'Stop any scene currently running in the editor',
73
+ parameters: z.object({}),
74
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
75
+ var godot, result, status_1, error_2;
76
+ var _a;
77
+ return __generator(this, function (_b) {
78
+ switch (_b.label) {
79
+ case 0:
80
+ godot = getGodotConnection();
81
+ _b.label = 1;
82
+ case 1:
83
+ _b.trys.push([1, 3, , 4]);
84
+ return [4 /*yield*/, godot.sendCommand('stop_running_project')];
85
+ case 2:
86
+ result = _b.sent();
87
+ status_1 = (_a = result === null || result === void 0 ? void 0 : result.status) !== null && _a !== void 0 ? _a : 'unknown';
88
+ if (status_1 === 'idle') {
89
+ return [2 /*return*/, 'Editor is not currently running a scene.'];
90
+ }
91
+ return [2 /*return*/, 'Stopped the running scene.'];
92
+ case 3:
93
+ error_2 = _b.sent();
94
+ throw new Error("Failed to stop running project: ".concat(error_2.message));
95
+ case 4: return [2 /*return*/];
96
+ }
97
+ });
98
+ }); },
99
+ },
100
+ {
101
+ name: 'run_current_scene',
102
+ description: 'Run the scene currently open in the editor',
103
+ parameters: z.object({}),
104
+ execute: function () { return __awaiter(void 0, void 0, void 0, function () {
105
+ var godot, result, scenePath, error_3;
106
+ var _a;
107
+ return __generator(this, function (_b) {
108
+ switch (_b.label) {
109
+ case 0:
110
+ godot = getGodotConnection();
111
+ _b.label = 1;
112
+ case 1:
113
+ _b.trys.push([1, 3, , 4]);
114
+ return [4 /*yield*/, godot.sendCommand('run_current_scene')];
115
+ case 2:
116
+ result = _b.sent();
117
+ scenePath = (_a = result === null || result === void 0 ? void 0 : result.scene_path) !== null && _a !== void 0 ? _a : ProjectRunMessages.unknownScene;
118
+ return [2 /*return*/, "Running current scene: ".concat(scenePath)];
119
+ case 3:
120
+ error_3 = _b.sent();
121
+ throw new Error("Failed to run current scene: ".concat(error_3.message));
122
+ case 4: return [2 /*return*/];
123
+ }
124
+ });
125
+ }); },
126
+ },
127
+ {
128
+ name: 'run_specific_scene',
129
+ description: 'Run a specific scene by providing its resource path',
130
+ parameters: z.object({
131
+ scene_path: z.string()
132
+ .describe('Absolute resource path to the scene (e.g. "res://scenes/main.tscn")'),
133
+ }),
134
+ execute: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
135
+ var godot, result, scenePath, error_4;
136
+ var _c;
137
+ var scene_path = _b.scene_path;
138
+ return __generator(this, function (_d) {
139
+ switch (_d.label) {
140
+ case 0:
141
+ godot = getGodotConnection();
142
+ _d.label = 1;
143
+ case 1:
144
+ _d.trys.push([1, 3, , 4]);
145
+ return [4 /*yield*/, godot.sendCommand('run_specific_scene', { scene_path: scene_path })];
146
+ case 2:
147
+ result = _d.sent();
148
+ scenePath = (_c = result === null || result === void 0 ? void 0 : result.scene_path) !== null && _c !== void 0 ? _c : scene_path;
149
+ return [2 /*return*/, "Running scene: ".concat(scenePath)];
150
+ case 3:
151
+ error_4 = _d.sent();
152
+ throw new Error("Failed to run scene \"".concat(scene_path, "\": ").concat(error_4.message));
153
+ case 4: return [2 /*return*/];
154
+ }
155
+ });
156
+ }); },
157
+ },
158
+ ];
159
+ var ProjectRunMessages = {
160
+ unknownScene: 'unknown scene',
161
+ };
162
+ //# sourceMappingURL=project_tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_tools.js","sourceRoot":"","sources":["../../src/tools/project_tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAOlE;;GAEG;AACH,MAAM,CAAC,IAAM,YAAY,GAAc;IACrC;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,iDAAiD;QAC9D,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE;;;;;;wBACD,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAGlB,qBAAM,KAAK,CAAC,WAAW,CAAgB,aAAa,CAAC,EAAA;;wBAA9D,MAAM,GAAG,SAAqD;wBAC9D,SAAS,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,kBAAkB,CAAC,YAAY,CAAC;wBACxE,sBAAO,4CAAqC,SAAS,CAAE,EAAC;;;wBAExD,MAAM,IAAI,KAAK,CAAC,iCAA2B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E,CAAC,CAAC,MAAM,EAAE;iBACnB,QAAQ,CAAC,qEAAqE,CAAC;SACnF,CAAC;QACF,OAAO,EAAE,iEAAO,EAAsC;;;gBAApC,UAAU,gBAAA;;;;wBACpB,KAAK,GAAG,kBAAkB,EAAE,CAAC;;;;wBAGlB,qBAAM,KAAK,CAAC,WAAW,CAAgB,oBAAoB,EAAE,EAAE,UAAU,YAAA,EAAE,CAAC,EAAA;;wBAArF,MAAM,GAAG,SAA4E;wBACrF,SAAS,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,mCAAI,UAAU,CAAC;wBACnD,sBAAO,yBAAkB,SAAS,CAAE,EAAC;;;wBAErC,MAAM,IAAI,KAAK,CAAC,gCAAwB,UAAU,iBAAO,OAAe,CAAC,OAAO,CAAE,CAAC,CAAC;;;;aAEvF;KACF;CACF,CAAC;AAEF,IAAM,kBAAkB,GAAG;IACzB,YAAY,EAAE,eAAe;CACrB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from '../utils/types.js';
2
+ /**
3
+ * Definition for scene tools - operations that manipulate Godot scenes
4
+ */
5
+ export declare const sceneTools: MCPTool[];