@satelliteoflove/godot-mcp 2.2.0 → 2.3.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/dist/tools/editor.d.ts +20 -5
- package/dist/tools/editor.d.ts.map +1 -1
- package/dist/tools/editor.js +27 -4
- package/dist/tools/editor.js.map +1 -1
- package/package.json +1 -1
package/dist/tools/editor.d.ts
CHANGED
|
@@ -1,40 +1,55 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { AnyToolDefinition } from '../core/types.js';
|
|
3
3
|
export declare const editor: import("../core/types.js").ToolDefinition<z.ZodEffects<z.ZodObject<{
|
|
4
|
-
action: z.ZodEnum<["get_state", "get_selection", "select", "run", "stop", "get_debug_output", "get_performance", "screenshot_game", "screenshot_editor"]>;
|
|
4
|
+
action: z.ZodEnum<["get_state", "get_selection", "select", "run", "stop", "get_debug_output", "get_performance", "screenshot_game", "screenshot_editor", "set_viewport_2d"]>;
|
|
5
5
|
node_path: z.ZodOptional<z.ZodString>;
|
|
6
6
|
scene_path: z.ZodOptional<z.ZodString>;
|
|
7
7
|
clear: z.ZodOptional<z.ZodBoolean>;
|
|
8
8
|
viewport: z.ZodOptional<z.ZodEnum<["2d", "3d"]>>;
|
|
9
9
|
max_width: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
center_x: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
center_y: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
10
13
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor";
|
|
14
|
+
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor" | "set_viewport_2d";
|
|
12
15
|
scene_path?: string | undefined;
|
|
13
16
|
node_path?: string | undefined;
|
|
14
17
|
clear?: boolean | undefined;
|
|
15
18
|
viewport?: "2d" | "3d" | undefined;
|
|
16
19
|
max_width?: number | undefined;
|
|
20
|
+
center_x?: number | undefined;
|
|
21
|
+
center_y?: number | undefined;
|
|
22
|
+
zoom?: number | undefined;
|
|
17
23
|
}, {
|
|
18
|
-
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor";
|
|
24
|
+
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor" | "set_viewport_2d";
|
|
19
25
|
scene_path?: string | undefined;
|
|
20
26
|
node_path?: string | undefined;
|
|
21
27
|
clear?: boolean | undefined;
|
|
22
28
|
viewport?: "2d" | "3d" | undefined;
|
|
23
29
|
max_width?: number | undefined;
|
|
30
|
+
center_x?: number | undefined;
|
|
31
|
+
center_y?: number | undefined;
|
|
32
|
+
zoom?: number | undefined;
|
|
24
33
|
}>, {
|
|
25
|
-
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor";
|
|
34
|
+
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor" | "set_viewport_2d";
|
|
26
35
|
scene_path?: string | undefined;
|
|
27
36
|
node_path?: string | undefined;
|
|
28
37
|
clear?: boolean | undefined;
|
|
29
38
|
viewport?: "2d" | "3d" | undefined;
|
|
30
39
|
max_width?: number | undefined;
|
|
40
|
+
center_x?: number | undefined;
|
|
41
|
+
center_y?: number | undefined;
|
|
42
|
+
zoom?: number | undefined;
|
|
31
43
|
}, {
|
|
32
|
-
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor";
|
|
44
|
+
action: "get_state" | "get_selection" | "select" | "run" | "stop" | "get_debug_output" | "get_performance" | "screenshot_game" | "screenshot_editor" | "set_viewport_2d";
|
|
33
45
|
scene_path?: string | undefined;
|
|
34
46
|
node_path?: string | undefined;
|
|
35
47
|
clear?: boolean | undefined;
|
|
36
48
|
viewport?: "2d" | "3d" | undefined;
|
|
37
49
|
max_width?: number | undefined;
|
|
50
|
+
center_x?: number | undefined;
|
|
51
|
+
center_y?: number | undefined;
|
|
52
|
+
zoom?: number | undefined;
|
|
38
53
|
}>>;
|
|
39
54
|
export declare const editorTools: AnyToolDefinition[];
|
|
40
55
|
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/tools/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/tools/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,kBAAkB,CAAC;AA8FxE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2GjB,CAAC;AAEH,eAAO,MAAM,WAAW,EAAe,iBAAiB,EAAE,CAAC"}
|
package/dist/tools/editor.js
CHANGED
|
@@ -10,8 +10,8 @@ function toImageContent(base64) {
|
|
|
10
10
|
const EditorSchema = z
|
|
11
11
|
.object({
|
|
12
12
|
action: z
|
|
13
|
-
.enum(['get_state', 'get_selection', 'select', 'run', 'stop', 'get_debug_output', 'get_performance', 'screenshot_game', 'screenshot_editor'])
|
|
14
|
-
.describe('Action: get_state, get_selection, select, run, stop, get_debug_output, get_performance, screenshot_game, screenshot_editor'),
|
|
13
|
+
.enum(['get_state', 'get_selection', 'select', 'run', 'stop', 'get_debug_output', 'get_performance', 'screenshot_game', 'screenshot_editor', 'set_viewport_2d'])
|
|
14
|
+
.describe('Action: get_state, get_selection, select, run, stop, get_debug_output, get_performance, screenshot_game, screenshot_editor, set_viewport_2d'),
|
|
15
15
|
node_path: z
|
|
16
16
|
.string()
|
|
17
17
|
.optional()
|
|
@@ -32,18 +32,33 @@ const EditorSchema = z
|
|
|
32
32
|
.number()
|
|
33
33
|
.optional()
|
|
34
34
|
.describe('Maximum width in pixels for screenshot (screenshot_game, screenshot_editor)'),
|
|
35
|
+
center_x: z
|
|
36
|
+
.number()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('X coordinate to center the 2D viewport on (set_viewport_2d only)'),
|
|
39
|
+
center_y: z
|
|
40
|
+
.number()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Y coordinate to center the 2D viewport on (set_viewport_2d only)'),
|
|
43
|
+
zoom: z
|
|
44
|
+
.number()
|
|
45
|
+
.positive()
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Zoom level for 2D viewport, e.g. 1.0 = 100%, 2.0 = 200% (set_viewport_2d only)'),
|
|
35
48
|
})
|
|
36
49
|
.refine((data) => {
|
|
37
50
|
switch (data.action) {
|
|
38
51
|
case 'select':
|
|
39
52
|
return !!data.node_path;
|
|
53
|
+
case 'set_viewport_2d':
|
|
54
|
+
return data.center_x !== undefined || data.center_y !== undefined || data.zoom !== undefined;
|
|
40
55
|
default:
|
|
41
56
|
return true;
|
|
42
57
|
}
|
|
43
|
-
}, { message: 'select
|
|
58
|
+
}, { message: 'select requires node_path; set_viewport_2d requires at least one of center_x, center_y, or zoom' });
|
|
44
59
|
export const editor = defineTool({
|
|
45
60
|
name: 'editor',
|
|
46
|
-
description: 'Control the Godot editor: get state, manage selection, run/stop project, get debug output, get performance metrics, capture screenshots',
|
|
61
|
+
description: 'Control the Godot editor: get state (includes viewport/camera info), manage selection, run/stop project, get debug output, get performance metrics, capture screenshots, set 2D viewport position/zoom',
|
|
47
62
|
schema: EditorSchema,
|
|
48
63
|
async execute(args, { godot }) {
|
|
49
64
|
switch (args.action) {
|
|
@@ -89,6 +104,14 @@ export const editor = defineTool({
|
|
|
89
104
|
const result = await godot.sendCommand('capture_editor_screenshot', { viewport: args.viewport, max_width: args.max_width });
|
|
90
105
|
return toImageContent(result.image_base64);
|
|
91
106
|
}
|
|
107
|
+
case 'set_viewport_2d': {
|
|
108
|
+
const result = await godot.sendCommand('set_2d_viewport', {
|
|
109
|
+
center_x: args.center_x ?? 0,
|
|
110
|
+
center_y: args.center_y ?? 0,
|
|
111
|
+
zoom: args.zoom ?? 1.0,
|
|
112
|
+
});
|
|
113
|
+
return `2D viewport set to center (${result.center.x.toFixed(1)}, ${result.center.y.toFixed(1)}) at ${result.zoom.toFixed(2)}x zoom`;
|
|
114
|
+
}
|
|
92
115
|
}
|
|
93
116
|
},
|
|
94
117
|
});
|
package/dist/tools/editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/tools/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../src/tools/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAgCpD,SAAS,cAAc,CAAC,MAAc;IACpC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,WAAW;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,CAAC;IACN,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,CAAC,WAAW,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,iBAAiB,E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