@akiojin/unity-mcp-server 2.40.2 → 2.40.3

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 (90) hide show
  1. package/README.md +21 -0
  2. package/bin/unity-mcp-server +1 -1
  3. package/package.json +1 -1
  4. package/src/core/codeIndex.js +64 -15
  5. package/src/core/server.js +3 -34
  6. package/src/handlers/analysis/AnalyzeSceneContentsToolHandler.js +27 -24
  7. package/src/handlers/analysis/FindByComponentToolHandler.js +4 -1
  8. package/src/handlers/analysis/GetAnimatorStateToolHandler.js +5 -5
  9. package/src/handlers/analysis/GetComponentValuesToolHandler.js +4 -1
  10. package/src/handlers/analysis/GetGameObjectDetailsToolHandler.js +27 -24
  11. package/src/handlers/analysis/GetInputActionsStateToolHandler.js +5 -5
  12. package/src/handlers/analysis/GetObjectReferencesToolHandler.js +4 -1
  13. package/src/handlers/asset/AssetDatabaseManageToolHandler.js +24 -6
  14. package/src/handlers/asset/AssetDependencyAnalyzeToolHandler.js +21 -11
  15. package/src/handlers/asset/AssetImportSettingsManageToolHandler.js +7 -7
  16. package/src/handlers/asset/AssetMaterialCreateToolHandler.js +78 -81
  17. package/src/handlers/asset/AssetMaterialModifyToolHandler.js +57 -61
  18. package/src/handlers/asset/AssetPrefabCreateToolHandler.js +61 -64
  19. package/src/handlers/asset/AssetPrefabExitModeToolHandler.js +9 -13
  20. package/src/handlers/asset/AssetPrefabInstantiateToolHandler.js +110 -116
  21. package/src/handlers/asset/AssetPrefabModifyToolHandler.js +58 -58
  22. package/src/handlers/asset/AssetPrefabOpenToolHandler.js +7 -5
  23. package/src/handlers/asset/AssetPrefabSaveToolHandler.js +13 -6
  24. package/src/handlers/compilation/CompilationGetStateToolHandler.js +4 -3
  25. package/src/handlers/component/ComponentAddToolHandler.js +2 -2
  26. package/src/handlers/component/ComponentGetTypesToolHandler.js +17 -21
  27. package/src/handlers/component/ComponentListToolHandler.js +5 -3
  28. package/src/handlers/component/ComponentModifyToolHandler.js +3 -3
  29. package/src/handlers/component/ComponentRemoveToolHandler.js +2 -2
  30. package/src/handlers/console/ConsoleClearToolHandler.js +36 -46
  31. package/src/handlers/editor/EditorLayersManageToolHandler.js +7 -6
  32. package/src/handlers/editor/EditorTagsManageToolHandler.js +20 -11
  33. package/src/handlers/editor/EditorToolsManageToolHandler.js +2 -2
  34. package/src/handlers/editor/EditorWindowsManageToolHandler.js +6 -5
  35. package/src/handlers/gameobject/GameObjectCreateToolHandler.js +62 -66
  36. package/src/handlers/gameobject/GameObjectDeleteToolHandler.js +9 -9
  37. package/src/handlers/gameobject/GameObjectFindToolHandler.js +13 -11
  38. package/src/handlers/gameobject/GameObjectGetHierarchyToolHandler.js +22 -16
  39. package/src/handlers/input/InputActionAddToolHandler.js +2 -2
  40. package/src/handlers/input/InputActionMapCreateToolHandler.js +2 -2
  41. package/src/handlers/input/InputActionMapRemoveToolHandler.js +2 -2
  42. package/src/handlers/input/InputActionRemoveToolHandler.js +2 -2
  43. package/src/handlers/input/InputBindingAddToolHandler.js +2 -2
  44. package/src/handlers/input/InputBindingCompositeCreateToolHandler.js +2 -2
  45. package/src/handlers/input/InputBindingRemoveAllToolHandler.js +2 -2
  46. package/src/handlers/input/InputBindingRemoveToolHandler.js +2 -2
  47. package/src/handlers/input/InputControlSchemesManageToolHandler.js +2 -2
  48. package/src/handlers/package/PackageManagerToolHandler.js +41 -44
  49. package/src/handlers/package/RegistryConfigToolHandler.js +28 -7
  50. package/src/handlers/playmode/PlaymodeGetStateToolHandler.js +12 -16
  51. package/src/handlers/playmode/PlaymodePauseToolHandler.js +8 -12
  52. package/src/handlers/playmode/PlaymodeWaitForStateToolHandler.js +6 -3
  53. package/src/handlers/scene/GetSceneInfoToolHandler.js +11 -11
  54. package/src/handlers/scene/SceneCreateToolHandler.js +28 -31
  55. package/src/handlers/scene/SceneListToolHandler.js +21 -24
  56. package/src/handlers/scene/SceneLoadToolHandler.js +27 -29
  57. package/src/handlers/scene/SceneSaveToolHandler.js +19 -22
  58. package/src/handlers/screenshot/ScreenshotCaptureToolHandler.js +88 -66
  59. package/src/handlers/script/CodeIndexStatusToolHandler.js +4 -3
  60. package/src/handlers/script/CodeIndexUpdateToolHandler.js +24 -14
  61. package/src/handlers/script/ScriptCreateClassToolHandler.js +44 -9
  62. package/src/handlers/script/ScriptPackagesListToolHandler.js +91 -91
  63. package/src/handlers/script/ScriptRefactorRenameToolHandler.js +80 -71
  64. package/src/handlers/script/ScriptRemoveSymbolToolHandler.js +21 -7
  65. package/src/handlers/script/ScriptSearchToolHandler.js +299 -266
  66. package/src/handlers/script/ScriptSymbolsGetToolHandler.js +88 -79
  67. package/src/handlers/settings/SettingsGetToolHandler.js +28 -13
  68. package/src/handlers/settings/SettingsUpdateToolHandler.js +20 -6
  69. package/src/handlers/ui/UIClickElementToolHandler.js +87 -96
  70. package/src/handlers/ui/UIFindElementsToolHandler.js +45 -55
  71. package/src/handlers/ui/UIGetElementStateToolHandler.js +35 -43
  72. package/src/handlers/ui/UISetElementValueToolHandler.js +42 -49
  73. package/src/handlers/ui/UISimulateInputToolHandler.js +134 -136
  74. package/src/handlers/video/VideoCaptureForToolHandler.js +24 -7
  75. package/src/lsp/LspRpcClient.js +24 -12
  76. package/src/tools/analysis/analyzeSceneContents.js +85 -85
  77. package/src/tools/analysis/findByComponent.js +73 -73
  78. package/src/tools/analysis/getAnimatorState.js +287 -287
  79. package/src/tools/analysis/getComponentValues.js +161 -161
  80. package/src/tools/analysis/getGameObjectDetails.js +138 -138
  81. package/src/tools/analysis/getInputActionsState.js +291 -291
  82. package/src/tools/analysis/getObjectReferences.js +72 -72
  83. package/src/tools/input/inputActionsEditor.js +522 -474
  84. package/src/tools/scene/createScene.js +98 -97
  85. package/src/tools/scene/getSceneInfo.js +82 -81
  86. package/src/tools/scene/listScenes.js +70 -69
  87. package/src/tools/scene/loadScene.js +108 -106
  88. package/src/tools/scene/saveScene.js +78 -77
  89. package/src/tools/system/ping.js +9 -12
  90. package/src/utils/validators.js +2 -2
@@ -1,133 +1,127 @@
1
1
  import { BaseToolHandler } from '../base/BaseToolHandler.js';
2
2
 
3
3
  export class AssetPrefabInstantiateToolHandler extends BaseToolHandler {
4
- constructor(unityConnection) {
5
- super(
6
- 'asset_prefab_instantiate',
7
- 'Instantiate a prefab in the scene with optional transform, parent, and name override.',
8
- {
9
- type: 'object',
10
- properties: {
11
- prefabPath: {
12
- type: 'string',
13
- description: 'Asset path to the prefab. Must start with Assets/ and end with .prefab.'
14
- },
15
- position: {
16
- type: 'object',
17
- properties: {
18
- x: { type: 'number' },
19
- y: { type: 'number' },
20
- z: { type: 'number' }
21
- },
22
- description: 'World position for the instance (requires x,y,z).'
23
- },
24
- rotation: {
25
- type: 'object',
26
- properties: {
27
- x: { type: 'number' },
28
- y: { type: 'number' },
29
- z: { type: 'number' }
30
- },
31
- description: 'Euler rotation for the instance (x,y,z).'
32
- },
33
- parent: {
34
- type: 'string',
35
- description: 'Parent GameObject scene path (optional).'
36
- },
37
- name: {
38
- type: 'string',
39
- description: 'Override name for the instantiated object.'
40
- }
41
- },
42
- required: ['prefabPath']
43
- }
44
- );
45
- this.unityConnection = unityConnection;
46
- }
4
+ constructor(unityConnection) {
5
+ super(
6
+ 'asset_prefab_instantiate',
7
+ 'Instantiate a prefab in the scene with optional transform, parent, and name override.',
8
+ {
9
+ type: 'object',
10
+ properties: {
11
+ prefabPath: {
12
+ type: 'string',
13
+ description: 'Asset path to the prefab. Must start with Assets/ and end with .prefab.'
14
+ },
15
+ position: {
16
+ type: 'object',
17
+ properties: {
18
+ x: { type: 'number' },
19
+ y: { type: 'number' },
20
+ z: { type: 'number' }
21
+ },
22
+ description: 'World position for the instance (requires x,y,z).'
23
+ },
24
+ rotation: {
25
+ type: 'object',
26
+ properties: {
27
+ x: { type: 'number' },
28
+ y: { type: 'number' },
29
+ z: { type: 'number' }
30
+ },
31
+ description: 'Euler rotation for the instance (x,y,z).'
32
+ },
33
+ parent: {
34
+ type: 'string',
35
+ description: 'Parent GameObject scene path (optional).'
36
+ },
37
+ name: {
38
+ type: 'string',
39
+ description: 'Override name for the instantiated object.'
40
+ }
41
+ },
42
+ required: ['prefabPath']
43
+ }
44
+ );
45
+ this.unityConnection = unityConnection;
46
+ }
47
47
 
48
- validate(params) {
49
- // Call parent validation for required fields
50
- super.validate(params);
48
+ validate(params) {
49
+ // Call parent validation for required fields
50
+ super.validate(params);
51
51
 
52
- const { prefabPath, parent, position, rotation } = params;
52
+ const { prefabPath, parent, position, rotation } = params;
53
53
 
54
- // Validate prefabPath format
55
- if (!prefabPath.startsWith('Assets/') || !prefabPath.endsWith('.prefab')) {
56
- throw new Error('prefabPath must start with Assets/ and end with .prefab');
57
- }
54
+ // Validate prefabPath format
55
+ if (!prefabPath.startsWith('Assets/') || !prefabPath.endsWith('.prefab')) {
56
+ throw new Error('prefabPath must start with Assets/ and end with .prefab');
57
+ }
58
58
 
59
- // Validate parent when provided
60
- if (parent !== undefined && parent === '') {
61
- throw new Error('parent cannot be empty when provided');
62
- }
59
+ // Validate parent when provided
60
+ if (parent !== undefined && parent === '') {
61
+ throw new Error('parent cannot be empty when provided');
62
+ }
63
63
 
64
- // Validate position object when provided
65
- if (position !== undefined) {
66
- if (typeof position !== 'object' || position === null) {
67
- throw new Error('position must be an object');
68
- }
69
-
70
- // Check individual properties first for better error messages
71
- if ('x' in position && typeof position.x !== 'number') {
72
- throw new Error('position.x must be a number');
73
- }
74
- if ('y' in position && typeof position.y !== 'number') {
75
- throw new Error('position.y must be a number');
76
- }
77
- if ('z' in position && typeof position.z !== 'number') {
78
- throw new Error('position.z must be a number');
79
- }
80
-
81
- // Then check for missing properties
82
- if (!('x' in position) || !('y' in position) || !('z' in position)) {
83
- throw new Error('position must have x, y, and z properties');
84
- }
85
- }
64
+ // Validate position object when provided
65
+ if (position !== undefined) {
66
+ if (typeof position !== 'object' || position === null) {
67
+ throw new Error('position must be an object');
68
+ }
86
69
 
87
- // Validate rotation object when provided
88
- if (rotation !== undefined) {
89
- if (typeof rotation !== 'object' || rotation === null) {
90
- throw new Error('rotation must be an object');
91
- }
92
-
93
- if (!('x' in rotation) || !('y' in rotation) || !('z' in rotation)) {
94
- throw new Error('rotation must have x, y, and z properties');
95
- }
70
+ // Check individual properties first for better error messages
71
+ if ('x' in position && typeof position.x !== 'number') {
72
+ throw new Error('position.x must be a number');
73
+ }
74
+ if ('y' in position && typeof position.y !== 'number') {
75
+ throw new Error('position.y must be a number');
76
+ }
77
+ if ('z' in position && typeof position.z !== 'number') {
78
+ throw new Error('position.z must be a number');
79
+ }
96
80
 
97
- if (typeof rotation.x !== 'number') {
98
- throw new Error('rotation.x must be a number');
99
- }
100
- if (typeof rotation.y !== 'number') {
101
- throw new Error('rotation.y must be a number');
102
- }
103
- if (typeof rotation.z !== 'number') {
104
- throw new Error('rotation.z must be a number');
105
- }
106
- }
81
+ // Then check for missing properties
82
+ if (!('x' in position) || !('y' in position) || !('z' in position)) {
83
+ throw new Error('position must have x, y, and z properties');
84
+ }
107
85
  }
108
86
 
109
- async execute(params) {
110
- const {
111
- prefabPath,
112
- position,
113
- rotation,
114
- parent,
115
- name
116
- } = params;
87
+ // Validate rotation object when provided
88
+ if (rotation !== undefined) {
89
+ if (typeof rotation !== 'object' || rotation === null) {
90
+ throw new Error('rotation must be an object');
91
+ }
117
92
 
118
- // Ensure connected
119
- if (!this.unityConnection.isConnected()) {
120
- await this.unityConnection.connect();
121
- }
93
+ if (!('x' in rotation) || !('y' in rotation) || !('z' in rotation)) {
94
+ throw new Error('rotation must have x, y, and z properties');
95
+ }
122
96
 
123
- const result = await this.unityConnection.sendCommand('instantiate_prefab', {
124
- prefabPath,
125
- position,
126
- rotation,
127
- parent,
128
- name
129
- });
97
+ if (typeof rotation.x !== 'number') {
98
+ throw new Error('rotation.x must be a number');
99
+ }
100
+ if (typeof rotation.y !== 'number') {
101
+ throw new Error('rotation.y must be a number');
102
+ }
103
+ if (typeof rotation.z !== 'number') {
104
+ throw new Error('rotation.z must be a number');
105
+ }
106
+ }
107
+ }
130
108
 
131
- return result;
109
+ async execute(params) {
110
+ const { prefabPath, position, rotation, parent, name } = params;
111
+
112
+ // Ensure connected
113
+ if (!this.unityConnection.isConnected()) {
114
+ await this.unityConnection.connect();
132
115
  }
116
+
117
+ const result = await this.unityConnection.sendCommand('instantiate_prefab', {
118
+ prefabPath,
119
+ position,
120
+ rotation,
121
+ parent,
122
+ name
123
+ });
124
+
125
+ return result;
126
+ }
133
127
  }
@@ -1,72 +1,72 @@
1
1
  import { BaseToolHandler } from '../base/BaseToolHandler.js';
2
2
 
3
3
  export class AssetPrefabModifyToolHandler extends BaseToolHandler {
4
- constructor(unityConnection) {
5
- super(
6
- 'asset_prefab_modify',
7
- 'Modify an existing prefab by applying property changes (optionally to instances).',
8
- {
9
- type: 'object',
10
- properties: {
11
- prefabPath: {
12
- type: 'string',
13
- description: 'Asset path to the prefab. Must start with Assets/ and end with .prefab.'
14
- },
15
- modifications: {
16
- type: 'object',
17
- description: 'Key/value object of properties to modify on the prefab.'
18
- },
19
- applyToInstances: {
20
- type: 'boolean',
21
- description: 'If true, also apply to existing scene instances (default: true).'
22
- }
23
- },
24
- required: ['prefabPath', 'modifications']
25
- }
26
- );
27
- this.unityConnection = unityConnection;
28
- }
4
+ constructor(unityConnection) {
5
+ super(
6
+ 'asset_prefab_modify',
7
+ 'Modify an existing prefab by applying property changes (optionally to instances).',
8
+ {
9
+ type: 'object',
10
+ properties: {
11
+ prefabPath: {
12
+ type: 'string',
13
+ description: 'Asset path to the prefab. Must start with Assets/ and end with .prefab.'
14
+ },
15
+ modifications: {
16
+ type: 'object',
17
+ description: 'Key/value object of properties to modify on the prefab.'
18
+ },
19
+ applyToInstances: {
20
+ type: 'boolean',
21
+ description: 'If true, also apply to existing scene instances (default: true).'
22
+ }
23
+ },
24
+ required: ['prefabPath', 'modifications']
25
+ }
26
+ );
27
+ this.unityConnection = unityConnection;
28
+ }
29
29
 
30
- validate(params) {
31
- // Call parent validation for required fields
32
- super.validate(params);
30
+ validate(params) {
31
+ // Call parent validation for required fields
32
+ super.validate(params);
33
33
 
34
- const { prefabPath, modifications } = params;
34
+ const { prefabPath, modifications } = params;
35
35
 
36
- // Validate prefabPath format
37
- if (!prefabPath.startsWith('Assets/') || !prefabPath.endsWith('.prefab')) {
38
- throw new Error('prefabPath must start with Assets/ and end with .prefab');
39
- }
36
+ // Validate prefabPath format
37
+ if (!prefabPath.startsWith('Assets/') || !prefabPath.endsWith('.prefab')) {
38
+ throw new Error('prefabPath must start with Assets/ and end with .prefab');
39
+ }
40
40
 
41
- // Validate modifications is object
42
- if (typeof modifications !== 'object' || modifications === null || Array.isArray(modifications)) {
43
- throw new Error('modifications must be an object');
44
- }
41
+ // Validate modifications is object
42
+ if (
43
+ typeof modifications !== 'object' ||
44
+ modifications === null ||
45
+ Array.isArray(modifications)
46
+ ) {
47
+ throw new Error('modifications must be an object');
48
+ }
45
49
 
46
- // Validate modifications is not empty
47
- if (Object.keys(modifications).length === 0) {
48
- throw new Error('modifications cannot be empty');
49
- }
50
+ // Validate modifications is not empty
51
+ if (Object.keys(modifications).length === 0) {
52
+ throw new Error('modifications cannot be empty');
50
53
  }
54
+ }
51
55
 
52
- async execute(params) {
53
- const {
54
- prefabPath,
55
- modifications,
56
- applyToInstances = true
57
- } = params;
56
+ async execute(params) {
57
+ const { prefabPath, modifications, applyToInstances = true } = params;
58
58
 
59
- // Ensure connected
60
- if (!this.unityConnection.isConnected()) {
61
- await this.unityConnection.connect();
62
- }
59
+ // Ensure connected
60
+ if (!this.unityConnection.isConnected()) {
61
+ await this.unityConnection.connect();
62
+ }
63
63
 
64
- const result = await this.unityConnection.sendCommand('modify_prefab', {
65
- prefabPath,
66
- modifications,
67
- applyToInstances
68
- });
64
+ const result = await this.unityConnection.sendCommand('modify_prefab', {
65
+ prefabPath,
66
+ modifications,
67
+ applyToInstances
68
+ });
69
69
 
70
- return result;
71
- }
70
+ return result;
71
+ }
72
72
  }
@@ -17,7 +17,8 @@ export class AssetPrefabOpenToolHandler extends BaseToolHandler {
17
17
  },
18
18
  focusObject: {
19
19
  type: 'string',
20
- description: 'Optional path to object within prefab to focus on (relative to prefab root)'
20
+ description:
21
+ 'Optional path to object within prefab to focus on (relative to prefab root)'
21
22
  },
22
23
  isolateObject: {
23
24
  type: 'boolean',
@@ -27,7 +28,7 @@ export class AssetPrefabOpenToolHandler extends BaseToolHandler {
27
28
  required: ['prefabPath']
28
29
  }
29
30
  );
30
-
31
+
31
32
  this.unityConnection = unityConnection;
32
33
  }
33
34
 
@@ -38,7 +39,7 @@ export class AssetPrefabOpenToolHandler extends BaseToolHandler {
38
39
  */
39
40
  validate(params) {
40
41
  super.validate(params); // Check required fields
41
-
42
+
42
43
  const { prefabPath } = params;
43
44
 
44
45
  // Validate prefabPath is not empty
@@ -111,11 +112,12 @@ export class AssetPrefabOpenToolHandler extends BaseToolHandler {
111
112
  }
112
113
  },
113
114
  openForComponentWork: {
114
- description: 'Open prefab for component inspection and modification (use with component tools like list_components, add_component, etc.)',
115
+ description:
116
+ 'Open prefab for component inspection and modification (use with component tools like list_components, add_component, etc.)',
115
117
  params: {
116
118
  prefabPath: 'Assets/Prefabs/Weapons/Sword.prefab'
117
119
  }
118
120
  }
119
121
  };
120
122
  }
121
- }
123
+ }
@@ -13,7 +13,8 @@ export class AssetPrefabSaveToolHandler extends BaseToolHandler {
13
13
  properties: {
14
14
  gameObjectPath: {
15
15
  type: 'string',
16
- description: 'Path to GameObject to save as prefab override (optional - if not provided, saves current prefab in prefab mode)'
16
+ description:
17
+ 'Path to GameObject to save as prefab override (optional - if not provided, saves current prefab in prefab mode)'
17
18
  },
18
19
  includeChildren: {
19
20
  type: 'boolean',
@@ -22,7 +23,7 @@ export class AssetPrefabSaveToolHandler extends BaseToolHandler {
22
23
  }
23
24
  }
24
25
  );
25
-
26
+
26
27
  this.unityConnection = unityConnection;
27
28
  }
28
29
 
@@ -63,11 +64,17 @@ export class AssetPrefabSaveToolHandler extends BaseToolHandler {
63
64
  return {
64
65
  success: response.success,
65
66
  message: response.message || 'Prefab saved',
66
- ...(response.savedInPrefabMode !== undefined && { savedInPrefabMode: response.savedInPrefabMode }),
67
+ ...(response.savedInPrefabMode !== undefined && {
68
+ savedInPrefabMode: response.savedInPrefabMode
69
+ }),
67
70
  ...(response.prefabPath !== undefined && { prefabPath: response.prefabPath }),
68
71
  ...(response.gameObjectPath !== undefined && { gameObjectPath: response.gameObjectPath }),
69
- ...(response.overridesApplied !== undefined && { overridesApplied: response.overridesApplied }),
70
- ...(response.includedChildren !== undefined && { includedChildren: response.includedChildren })
72
+ ...(response.overridesApplied !== undefined && {
73
+ overridesApplied: response.overridesApplied
74
+ }),
75
+ ...(response.includedChildren !== undefined && {
76
+ includedChildren: response.includedChildren
77
+ })
71
78
  };
72
79
  }
73
80
 
@@ -103,4 +110,4 @@ export class AssetPrefabSaveToolHandler extends BaseToolHandler {
103
110
  }
104
111
  };
105
112
  }
106
- }
113
+ }
@@ -13,7 +13,8 @@ export class CompilationGetStateToolHandler extends BaseToolHandler {
13
13
  properties: {
14
14
  includeMessages: {
15
15
  type: 'boolean',
16
- description: 'Include detailed compilation messages. Unity default: false. Set to true for debugging compilation issues'
16
+ description:
17
+ 'Include detailed compilation messages. Unity default: false. Set to true for debugging compilation issues'
17
18
  },
18
19
  maxMessages: {
19
20
  type: 'number',
@@ -22,7 +23,7 @@ export class CompilationGetStateToolHandler extends BaseToolHandler {
22
23
  }
23
24
  }
24
25
  );
25
-
26
+
26
27
  this.unityConnection = unityConnection;
27
28
  }
28
29
 
@@ -87,4 +88,4 @@ export class CompilationGetStateToolHandler extends BaseToolHandler {
87
88
  }
88
89
  };
89
90
  }
90
- }
91
+ }
@@ -28,7 +28,7 @@ export class ComponentAddToolHandler extends BaseToolHandler {
28
28
  required: ['gameObjectPath', 'componentType']
29
29
  }
30
30
  );
31
-
31
+
32
32
  this.unityConnection = unityConnection;
33
33
  }
34
34
 
@@ -39,7 +39,7 @@ export class ComponentAddToolHandler extends BaseToolHandler {
39
39
  */
40
40
  validate(params) {
41
41
  super.validate(params); // Check required fields
42
-
42
+
43
43
  const { gameObjectPath, componentType } = params;
44
44
 
45
45
  if (!gameObjectPath || gameObjectPath.trim() === '') {
@@ -5,28 +5,24 @@ import { BaseToolHandler } from '../base/BaseToolHandler.js';
5
5
  */
6
6
  export class ComponentGetTypesToolHandler extends BaseToolHandler {
7
7
  constructor(unityConnection) {
8
- super(
9
- 'component_get_types',
10
- 'Get available component types in Unity',
11
- {
12
- type: 'object',
13
- properties: {
14
- category: {
15
- type: 'string',
16
- description: 'Filter by category (e.g., "Physics", "Rendering", "UI")'
17
- },
18
- search: {
19
- type: 'string',
20
- description: 'Search for component types by name'
21
- },
22
- onlyAddable: {
23
- type: 'boolean',
24
- description: 'Return only components that can be added to GameObjects (default: false)'
25
- }
8
+ super('component_get_types', 'Get available component types in Unity', {
9
+ type: 'object',
10
+ properties: {
11
+ category: {
12
+ type: 'string',
13
+ description: 'Filter by category (e.g., "Physics", "Rendering", "UI")'
14
+ },
15
+ search: {
16
+ type: 'string',
17
+ description: 'Search for component types by name'
18
+ },
19
+ onlyAddable: {
20
+ type: 'boolean',
21
+ description: 'Return only components that can be added to GameObjects (default: false)'
26
22
  }
27
23
  }
28
- );
29
-
24
+ });
25
+
30
26
  this.unityConnection = unityConnection;
31
27
  }
32
28
 
@@ -97,4 +93,4 @@ export class ComponentGetTypesToolHandler extends BaseToolHandler {
97
93
  }
98
94
  };
99
95
  }
100
- }
96
+ }
@@ -23,7 +23,7 @@ export class ComponentListToolHandler extends BaseToolHandler {
23
23
  required: ['gameObjectPath']
24
24
  }
25
25
  );
26
-
26
+
27
27
  this.unityConnection = unityConnection;
28
28
  }
29
29
 
@@ -51,7 +51,9 @@ export class ComponentListToolHandler extends BaseToolHandler {
51
51
  gameObjectPath: response.gameObjectPath,
52
52
  components: response.components || [],
53
53
  componentCount: response.componentCount || 0,
54
- ...(response.includesInherited !== undefined && { includesInherited: response.includesInherited })
54
+ ...(response.includesInherited !== undefined && {
55
+ includesInherited: response.includesInherited
56
+ })
55
57
  };
56
58
  }
57
59
 
@@ -82,4 +84,4 @@ export class ComponentListToolHandler extends BaseToolHandler {
82
84
  }
83
85
  };
84
86
  }
85
- }
87
+ }
@@ -32,7 +32,7 @@ export class ComponentModifyToolHandler extends BaseToolHandler {
32
32
  required: ['gameObjectPath', 'componentType', 'properties']
33
33
  }
34
34
  );
35
-
35
+
36
36
  this.unityConnection = unityConnection;
37
37
  }
38
38
 
@@ -43,7 +43,7 @@ export class ComponentModifyToolHandler extends BaseToolHandler {
43
43
  */
44
44
  validate(params) {
45
45
  super.validate(params); // Check required fields
46
-
46
+
47
47
  const { properties } = params;
48
48
 
49
49
  // Validate properties is not empty
@@ -140,4 +140,4 @@ export class ComponentModifyToolHandler extends BaseToolHandler {
140
140
  }
141
141
  };
142
142
  }
143
- }
143
+ }
@@ -27,7 +27,7 @@ export class ComponentRemoveToolHandler extends BaseToolHandler {
27
27
  required: ['gameObjectPath', 'componentType']
28
28
  }
29
29
  );
30
-
30
+
31
31
  this.unityConnection = unityConnection;
32
32
  }
33
33
 
@@ -38,7 +38,7 @@ export class ComponentRemoveToolHandler extends BaseToolHandler {
38
38
  */
39
39
  validate(params) {
40
40
  super.validate(params); // Check required fields
41
-
41
+
42
42
  const { componentIndex } = params;
43
43
 
44
44
  // Validate component index if provided