@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
@@ -2,181 +2,181 @@
2
2
  * Tool definition for analysis_component_values_get
3
3
  */
4
4
  export const getComponentValuesToolDefinition = {
5
- name: 'analysis_component_values_get',
6
- description: 'Get properties/values from a component on a GameObject (scene or prefab mode).',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {
10
- gameObjectName: {
11
- type: 'string',
12
- description: 'Name of the GameObject'
13
- },
14
- componentType: {
15
- type: 'string',
16
- description: 'Type of component (e.g., "Light", "Camera", "Rigidbody")'
17
- },
18
- componentIndex: {
19
- type: 'number',
20
- description: 'Index if multiple components of same type. Default: 0'
21
- },
22
- includePrivateFields: {
23
- type: 'boolean',
24
- description: 'Include non-public fields. Default: false'
25
- },
26
- includeInherited: {
27
- type: 'boolean',
28
- description: 'Include inherited properties. Default: true'
29
- }
30
- },
31
- required: ['gameObjectName', 'componentType']
32
- }
5
+ name: 'analysis_component_values_get',
6
+ description: 'Get properties/values from a component on a GameObject (scene or prefab mode).',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ gameObjectName: {
11
+ type: 'string',
12
+ description: 'Name of the GameObject'
13
+ },
14
+ componentType: {
15
+ type: 'string',
16
+ description: 'Type of component (e.g., "Light", "Camera", "Rigidbody")'
17
+ },
18
+ componentIndex: {
19
+ type: 'number',
20
+ description: 'Index if multiple components of same type. Default: 0'
21
+ },
22
+ includePrivateFields: {
23
+ type: 'boolean',
24
+ description: 'Include non-public fields. Default: false'
25
+ },
26
+ includeInherited: {
27
+ type: 'boolean',
28
+ description: 'Include inherited properties. Default: true'
29
+ }
30
+ },
31
+ required: ['gameObjectName', 'componentType']
32
+ }
33
33
  };
34
34
 
35
35
  /**
36
36
  * Handler for get_component_values tool
37
37
  */
38
38
  export async function getComponentValuesHandler(unityConnection, args) {
39
- try {
40
- // Check connection
41
- if (!unityConnection.isConnected()) {
42
- return {
43
- content: [
44
- {
45
- type: 'text',
46
- text: 'Failed to get component values: Unity connection not available'
47
- }
48
- ],
49
- isError: true
50
- };
51
- }
39
+ try {
40
+ // Check connection
41
+ if (!unityConnection.isConnected()) {
42
+ return {
43
+ content: [
44
+ {
45
+ type: 'text',
46
+ text: 'Failed to get component values: Unity connection not available'
47
+ }
48
+ ],
49
+ isError: true
50
+ };
51
+ }
52
52
 
53
- // Validate required parameters
54
- if (!args.componentType) {
55
- return {
56
- content: [
57
- {
58
- type: 'text',
59
- text: 'Failed to get component values: componentType is required'
60
- }
61
- ],
62
- isError: true
63
- };
64
- }
53
+ // Validate required parameters
54
+ if (!args.componentType) {
55
+ return {
56
+ content: [
57
+ {
58
+ type: 'text',
59
+ text: 'Failed to get component values: componentType is required'
60
+ }
61
+ ],
62
+ isError: true
63
+ };
64
+ }
65
65
 
66
- // Validate componentIndex if provided
67
- if (args.componentIndex !== undefined && args.componentIndex < 0) {
68
- return {
69
- content: [
70
- {
71
- type: 'text',
72
- text: 'Failed to get component values: componentIndex must be non-negative'
73
- }
74
- ],
75
- isError: true
76
- };
77
- }
66
+ // Validate componentIndex if provided
67
+ if (args.componentIndex !== undefined && args.componentIndex < 0) {
68
+ return {
69
+ content: [
70
+ {
71
+ type: 'text',
72
+ text: 'Failed to get component values: componentIndex must be non-negative'
73
+ }
74
+ ],
75
+ isError: true
76
+ };
77
+ }
78
78
 
79
- // Send command to Unity
80
- const result = await unityConnection.sendCommand('analysis_component_values_get', args);
79
+ // Send command to Unity
80
+ const result = await unityConnection.sendCommand('analysis_component_values_get', args);
81
81
 
82
- // The unityConnection.sendCommand already extracts the result field
83
- // from the response, so we access properties directly on result
84
- if (!result || typeof result === 'string') {
85
- return {
86
- content: [
87
- {
88
- type: 'text',
89
- text: `Failed to get component values: Invalid response format`
90
- }
91
- ],
92
- isError: true
93
- };
94
- }
82
+ // The unityConnection.sendCommand already extracts the result field
83
+ // from the response, so we access properties directly on result
84
+ if (!result || typeof result === 'string') {
85
+ return {
86
+ content: [
87
+ {
88
+ type: 'text',
89
+ text: `Failed to get component values: Invalid response format`
90
+ }
91
+ ],
92
+ isError: true
93
+ };
94
+ }
95
95
 
96
- // Check if result has error property (error response from Unity)
97
- if (result.error) {
98
- return {
99
- content: [
100
- {
101
- type: 'text',
102
- text: `Failed to get component values: ${result.error}`
103
- }
104
- ],
105
- isError: true
106
- };
107
- }
96
+ // Check if result has error property (error response from Unity)
97
+ if (result.error) {
98
+ return {
99
+ content: [
100
+ {
101
+ type: 'text',
102
+ text: `Failed to get component values: ${result.error}`
103
+ }
104
+ ],
105
+ isError: true
106
+ };
107
+ }
108
+
109
+ // Success response - result is already the unwrapped data
110
+ console.log('[DEBUG] GetComponentValues - Full result:', JSON.stringify(result, null, 2));
108
111
 
109
- // Success response - result is already the unwrapped data
110
- console.log('[DEBUG] GetComponentValues - Full result:', JSON.stringify(result, null, 2));
111
-
112
- let responseText = result.summary || `Component values retrieved`;
113
-
114
- // Add detailed property information if available
115
- if (result.properties && Object.keys(result.properties).length > 0) {
116
- console.log('[DEBUG] Properties found:', Object.keys(result.properties).length);
117
- responseText += '\n\nProperties:';
118
- for (const [key, value] of Object.entries(result.properties)) {
119
- if (value && typeof value === 'object') {
120
- if (value.error) {
121
- responseText += `\n- ${key}: ERROR - ${value.error}`;
122
- } else {
123
- const valueStr = value.value ? JSON.stringify(value.value, null, 2) : 'null';
124
- const typeStr = value.type || 'unknown';
125
- responseText += `\n- ${key} (${typeStr}): ${valueStr}`;
126
-
127
- // Add range info if available
128
- if (value.range) {
129
- responseText += ` [range: ${value.range.min}-${value.range.max}]`;
130
- }
131
-
132
- // Add tooltip if available
133
- if (value.tooltip) {
134
- responseText += ` // ${value.tooltip}`;
135
- }
136
-
137
- // Add serialization info
138
- if (value.serialized) {
139
- responseText += ` (SerializeField)`;
140
- }
141
- if (value.hiddenInInspector) {
142
- responseText += ` (HideInInspector)`;
143
- }
144
- }
145
- }
112
+ let responseText = result.summary || `Component values retrieved`;
113
+
114
+ // Add detailed property information if available
115
+ if (result.properties && Object.keys(result.properties).length > 0) {
116
+ console.log('[DEBUG] Properties found:', Object.keys(result.properties).length);
117
+ responseText += '\n\nProperties:';
118
+ for (const [key, value] of Object.entries(result.properties)) {
119
+ if (value && typeof value === 'object') {
120
+ if (value.error) {
121
+ responseText += `\n- ${key}: ERROR - ${value.error}`;
122
+ } else {
123
+ const valueStr = value.value ? JSON.stringify(value.value, null, 2) : 'null';
124
+ const typeStr = value.type || 'unknown';
125
+ responseText += `\n- ${key} (${typeStr}): ${valueStr}`;
126
+
127
+ // Add range info if available
128
+ if (value.range) {
129
+ responseText += ` [range: ${value.range.min}-${value.range.max}]`;
146
130
  }
147
- } else {
148
- console.log('[DEBUG] No properties found in result');
149
- console.log('[DEBUG] Result keys:', Object.keys(result));
150
- }
151
-
152
- // Add debug information if available
153
- if (result.debug) {
154
- responseText += '\n\nDebug Info:';
155
- responseText += `\n- Properties type: ${result.debug.propertiesType}`;
156
- responseText += `\n- Properties count: ${result.debug.propertiesCount}`;
157
- if (result.debug.firstPropertyKey) {
158
- responseText += `\n- First property key: ${result.debug.firstPropertyKey}`;
131
+
132
+ // Add tooltip if available
133
+ if (value.tooltip) {
134
+ responseText += ` // ${value.tooltip}`;
135
+ }
136
+
137
+ // Add serialization info
138
+ if (value.serialized) {
139
+ responseText += ` (SerializeField)`;
159
140
  }
141
+ if (value.hiddenInInspector) {
142
+ responseText += ` (HideInInspector)`;
143
+ }
144
+ }
160
145
  }
161
-
162
- return {
163
- content: [
164
- {
165
- type: 'text',
166
- text: responseText
167
- }
168
- ],
169
- isError: false
170
- };
171
- } catch (error) {
172
- return {
173
- content: [
174
- {
175
- type: 'text',
176
- text: `Failed to get component values: ${error.message}`
177
- }
178
- ],
179
- isError: true
180
- };
146
+ }
147
+ } else {
148
+ console.log('[DEBUG] No properties found in result');
149
+ console.log('[DEBUG] Result keys:', Object.keys(result));
150
+ }
151
+
152
+ // Add debug information if available
153
+ if (result.debug) {
154
+ responseText += '\n\nDebug Info:';
155
+ responseText += `\n- Properties type: ${result.debug.propertiesType}`;
156
+ responseText += `\n- Properties count: ${result.debug.propertiesCount}`;
157
+ if (result.debug.firstPropertyKey) {
158
+ responseText += `\n- First property key: ${result.debug.firstPropertyKey}`;
159
+ }
181
160
  }
161
+
162
+ return {
163
+ content: [
164
+ {
165
+ type: 'text',
166
+ text: responseText
167
+ }
168
+ ],
169
+ isError: false
170
+ };
171
+ } catch (error) {
172
+ return {
173
+ content: [
174
+ {
175
+ type: 'text',
176
+ text: `Failed to get component values: ${error.message}`
177
+ }
178
+ ],
179
+ isError: true
180
+ };
181
+ }
182
182
  }
@@ -2,158 +2,158 @@
2
2
  * Tool definition for analysis_gameobject_details_get
3
3
  */
4
4
  export const getGameObjectDetailsToolDefinition = {
5
- name: 'analysis_gameobject_details_get',
6
- description: 'Get details for a GameObject by name or path (children/components/materials).',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {
10
- gameObjectName: {
11
- type: 'string',
12
- description: 'Name of the GameObject to inspect'
13
- },
14
- path: {
15
- type: 'string',
16
- description: 'Full hierarchy path to the GameObject (use either name or path)'
17
- },
18
- includeChildren: {
19
- type: 'boolean',
20
- description: 'Include full hierarchy details. Default: false'
21
- },
22
- includeComponents: {
23
- type: 'boolean',
24
- description: 'Include all component details. Default: true'
25
- },
26
- includeMaterials: {
27
- type: 'boolean',
28
- description: 'Include material information. Default: false'
29
- },
30
- maxDepth: {
31
- type: 'number',
32
- description: 'Maximum depth for child traversal. Default: 3, Range: 0-10'
33
- }
34
- },
35
- required: ['gameObjectName']
36
- }
5
+ name: 'analysis_gameobject_details_get',
6
+ description: 'Get details for a GameObject by name or path (children/components/materials).',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ gameObjectName: {
11
+ type: 'string',
12
+ description: 'Name of the GameObject to inspect'
13
+ },
14
+ path: {
15
+ type: 'string',
16
+ description: 'Full hierarchy path to the GameObject (use either name or path)'
17
+ },
18
+ includeChildren: {
19
+ type: 'boolean',
20
+ description: 'Include full hierarchy details. Default: false'
21
+ },
22
+ includeComponents: {
23
+ type: 'boolean',
24
+ description: 'Include all component details. Default: true'
25
+ },
26
+ includeMaterials: {
27
+ type: 'boolean',
28
+ description: 'Include material information. Default: false'
29
+ },
30
+ maxDepth: {
31
+ type: 'number',
32
+ description: 'Maximum depth for child traversal. Default: 3, Range: 0-10'
33
+ }
34
+ },
35
+ required: ['gameObjectName']
36
+ }
37
37
  };
38
38
 
39
39
  /**
40
40
  * Handler for get_gameobject_details tool
41
41
  */
42
42
  export async function getGameObjectDetailsHandler(unityConnection, args) {
43
- try {
44
- // Check connection
45
- if (!unityConnection.isConnected()) {
46
- return {
47
- content: [
48
- {
49
- type: 'text',
50
- text: 'Failed to get GameObject details: Unity connection not available'
51
- }
52
- ],
53
- isError: true
54
- };
55
- }
43
+ try {
44
+ // Check connection
45
+ if (!unityConnection.isConnected()) {
46
+ return {
47
+ content: [
48
+ {
49
+ type: 'text',
50
+ text: 'Failed to get GameObject details: Unity connection not available'
51
+ }
52
+ ],
53
+ isError: true
54
+ };
55
+ }
56
56
 
57
- // Validate that either gameObjectName or path is provided
58
- if (!args.gameObjectName && !args.path) {
59
- return {
60
- content: [
61
- {
62
- type: 'text',
63
- text: 'Failed to get GameObject details: Either gameObjectName or path must be provided'
64
- }
65
- ],
66
- isError: true
67
- };
68
- }
57
+ // Validate that either gameObjectName or path is provided
58
+ if (!args.gameObjectName && !args.path) {
59
+ return {
60
+ content: [
61
+ {
62
+ type: 'text',
63
+ text: 'Failed to get GameObject details: Either gameObjectName or path must be provided'
64
+ }
65
+ ],
66
+ isError: true
67
+ };
68
+ }
69
69
 
70
- // Validate that only one identifier is provided
71
- if (args.gameObjectName && args.path) {
72
- return {
73
- content: [
74
- {
75
- type: 'text',
76
- text: 'Failed to get GameObject details: Provide either gameObjectName or path, not both'
77
- }
78
- ],
79
- isError: true
80
- };
81
- }
70
+ // Validate that only one identifier is provided
71
+ if (args.gameObjectName && args.path) {
72
+ return {
73
+ content: [
74
+ {
75
+ type: 'text',
76
+ text: 'Failed to get GameObject details: Provide either gameObjectName or path, not both'
77
+ }
78
+ ],
79
+ isError: true
80
+ };
81
+ }
82
82
 
83
- // Validate maxDepth if provided
84
- if (args.maxDepth !== undefined) {
85
- if (args.maxDepth < 0 || args.maxDepth > 10) {
86
- return {
87
- content: [
88
- {
89
- type: 'text',
90
- text: 'Failed to get GameObject details: maxDepth must be between 0 and 10'
91
- }
92
- ],
93
- isError: true
94
- };
83
+ // Validate maxDepth if provided
84
+ if (args.maxDepth !== undefined) {
85
+ if (args.maxDepth < 0 || args.maxDepth > 10) {
86
+ return {
87
+ content: [
88
+ {
89
+ type: 'text',
90
+ text: 'Failed to get GameObject details: maxDepth must be between 0 and 10'
95
91
  }
96
- }
92
+ ],
93
+ isError: true
94
+ };
95
+ }
96
+ }
97
97
 
98
- // Build params only with provided values and defaults where needed
99
- const params = {};
100
-
101
- if (args.gameObjectName) params.gameObjectName = args.gameObjectName;
102
- if (args.path) params.path = args.path;
103
- if (args.includeChildren !== undefined) params.includeChildren = args.includeChildren;
104
- if (args.includeComponents !== undefined) params.includeComponents = args.includeComponents;
105
- if (args.includeMaterials !== undefined) params.includeMaterials = args.includeMaterials;
106
- if (args.maxDepth !== undefined) params.maxDepth = args.maxDepth;
98
+ // Build params only with provided values and defaults where needed
99
+ const params = {};
107
100
 
108
- // Send command to Unity
109
- const result = await unityConnection.sendCommand('analysis_gameobject_details_get', args);
101
+ if (args.gameObjectName) params.gameObjectName = args.gameObjectName;
102
+ if (args.path) params.path = args.path;
103
+ if (args.includeChildren !== undefined) params.includeChildren = args.includeChildren;
104
+ if (args.includeComponents !== undefined) params.includeComponents = args.includeComponents;
105
+ if (args.includeMaterials !== undefined) params.includeMaterials = args.includeMaterials;
106
+ if (args.maxDepth !== undefined) params.maxDepth = args.maxDepth;
110
107
 
111
- // The unityConnection.sendCommand already extracts the result field
112
- // from the response, so we access properties directly on result
113
- if (!result || typeof result === 'string') {
114
- return {
115
- content: [
116
- {
117
- type: 'text',
118
- text: `Failed to get GameObject details: Invalid response format`
119
- }
120
- ],
121
- isError: true
122
- };
123
- }
108
+ // Send command to Unity
109
+ const result = await unityConnection.sendCommand('analysis_gameobject_details_get', args);
124
110
 
125
- // Check if result has error property (error response from Unity)
126
- if (result.error) {
127
- return {
128
- content: [
129
- {
130
- type: 'text',
131
- text: `Failed to get GameObject details: ${result.error}`
132
- }
133
- ],
134
- isError: true
135
- };
136
- }
111
+ // The unityConnection.sendCommand already extracts the result field
112
+ // from the response, so we access properties directly on result
113
+ if (!result || typeof result === 'string') {
114
+ return {
115
+ content: [
116
+ {
117
+ type: 'text',
118
+ text: `Failed to get GameObject details: Invalid response format`
119
+ }
120
+ ],
121
+ isError: true
122
+ };
123
+ }
137
124
 
138
- // Success response - result is already the unwrapped data
139
- return {
140
- content: [
141
- {
142
- type: 'text',
143
- text: result.summary || `GameObject details retrieved`
144
- }
145
- ],
146
- isError: false
147
- };
148
- } catch (error) {
149
- return {
150
- content: [
151
- {
152
- type: 'text',
153
- text: `Failed to get GameObject details: ${error.message}`
154
- }
155
- ],
156
- isError: true
157
- };
125
+ // Check if result has error property (error response from Unity)
126
+ if (result.error) {
127
+ return {
128
+ content: [
129
+ {
130
+ type: 'text',
131
+ text: `Failed to get GameObject details: ${result.error}`
132
+ }
133
+ ],
134
+ isError: true
135
+ };
158
136
  }
137
+
138
+ // Success response - result is already the unwrapped data
139
+ return {
140
+ content: [
141
+ {
142
+ type: 'text',
143
+ text: result.summary || `GameObject details retrieved`
144
+ }
145
+ ],
146
+ isError: false
147
+ };
148
+ } catch (error) {
149
+ return {
150
+ content: [
151
+ {
152
+ type: 'text',
153
+ text: `Failed to get GameObject details: ${error.message}`
154
+ }
155
+ ],
156
+ isError: true
157
+ };
158
+ }
159
159
  }