@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,326 +1,326 @@
1
1
  // Tool definition for analysis_animator_state_get
2
2
  export const getAnimatorStateToolDefinition = {
3
- name: 'analysis_animator_state_get',
4
- description: 'Get Animator state: layers, transitions, and parameter values for a GameObject.',
5
- inputSchema: {
6
- type: 'object',
7
- properties: {
8
- gameObjectName: {
9
- type: 'string',
10
- description: 'Name of the GameObject with the Animator component'
11
- },
12
- includeParameters: {
13
- type: 'boolean',
14
- description: 'Include all animator parameters and their current values. Default: true',
15
- default: true
16
- },
17
- includeStates: {
18
- type: 'boolean',
19
- description: 'Include current state information for each layer. Default: true',
20
- default: true
21
- },
22
- includeTransitions: {
23
- type: 'boolean',
24
- description: 'Include active transition information. Default: true',
25
- default: true
26
- },
27
- includeClips: {
28
- type: 'boolean',
29
- description: 'Include animation clip information. Default: false',
30
- default: false
31
- },
32
- layerIndex: {
33
- type: 'number',
34
- description: 'Specific layer index to query (-1 for all layers). Default: -1',
35
- default: -1
36
- }
37
- },
38
- required: ['gameObjectName']
39
- }
3
+ name: 'analysis_animator_state_get',
4
+ description: 'Get Animator state: layers, transitions, and parameter values for a GameObject.',
5
+ inputSchema: {
6
+ type: 'object',
7
+ properties: {
8
+ gameObjectName: {
9
+ type: 'string',
10
+ description: 'Name of the GameObject with the Animator component'
11
+ },
12
+ includeParameters: {
13
+ type: 'boolean',
14
+ description: 'Include all animator parameters and their current values. Default: true',
15
+ default: true
16
+ },
17
+ includeStates: {
18
+ type: 'boolean',
19
+ description: 'Include current state information for each layer. Default: true',
20
+ default: true
21
+ },
22
+ includeTransitions: {
23
+ type: 'boolean',
24
+ description: 'Include active transition information. Default: true',
25
+ default: true
26
+ },
27
+ includeClips: {
28
+ type: 'boolean',
29
+ description: 'Include animation clip information. Default: false',
30
+ default: false
31
+ },
32
+ layerIndex: {
33
+ type: 'number',
34
+ description: 'Specific layer index to query (-1 for all layers). Default: -1',
35
+ default: -1
36
+ }
37
+ },
38
+ required: ['gameObjectName']
39
+ }
40
40
  };
41
41
 
42
42
  // Tool definition for analysis_animator_runtime_info_get
43
43
  export const getAnimatorRuntimeInfoToolDefinition = {
44
- name: 'analysis_animator_runtime_info_get',
45
- description: 'Get Animator runtime info (IK, root motion, performance) — Play mode only.',
46
- inputSchema: {
47
- type: 'object',
48
- properties: {
49
- gameObjectName: {
50
- type: 'string',
51
- description: 'Name of the GameObject with the Animator component'
52
- },
53
- includeIK: {
54
- type: 'boolean',
55
- description: 'Include IK (Inverse Kinematics) information. Default: true',
56
- default: true
57
- },
58
- includeRootMotion: {
59
- type: 'boolean',
60
- description: 'Include root motion information. Default: true',
61
- default: true
62
- },
63
- includeBehaviours: {
64
- type: 'boolean',
65
- description: 'Include state machine behaviours. Default: false',
66
- default: false
67
- }
68
- },
69
- required: ['gameObjectName']
70
- }
44
+ name: 'analysis_animator_runtime_info_get',
45
+ description: 'Get Animator runtime info (IK, root motion, performance) — Play mode only.',
46
+ inputSchema: {
47
+ type: 'object',
48
+ properties: {
49
+ gameObjectName: {
50
+ type: 'string',
51
+ description: 'Name of the GameObject with the Animator component'
52
+ },
53
+ includeIK: {
54
+ type: 'boolean',
55
+ description: 'Include IK (Inverse Kinematics) information. Default: true',
56
+ default: true
57
+ },
58
+ includeRootMotion: {
59
+ type: 'boolean',
60
+ description: 'Include root motion information. Default: true',
61
+ default: true
62
+ },
63
+ includeBehaviours: {
64
+ type: 'boolean',
65
+ description: 'Include state machine behaviours. Default: false',
66
+ default: false
67
+ }
68
+ },
69
+ required: ['gameObjectName']
70
+ }
71
71
  };
72
72
 
73
73
  // Handler for get_animator_state
74
74
  export async function getAnimatorStateHandler(unityConnection, args) {
75
- try {
76
- // Check connection
77
- if (!unityConnection.isConnected()) {
78
- return {
79
- content: [
80
- {
81
- type: 'text',
82
- text: 'Failed to get animator state: Unity connection not available'
83
- }
84
- ],
85
- isError: true
86
- };
87
- }
75
+ try {
76
+ // Check connection
77
+ if (!unityConnection.isConnected()) {
78
+ return {
79
+ content: [
80
+ {
81
+ type: 'text',
82
+ text: 'Failed to get animator state: Unity connection not available'
83
+ }
84
+ ],
85
+ isError: true
86
+ };
87
+ }
88
88
 
89
- // Validate required parameters
90
- if (!args.gameObjectName) {
91
- return {
92
- content: [
93
- {
94
- type: 'text',
95
- text: 'Failed to get animator state: gameObjectName is required'
96
- }
97
- ],
98
- isError: true
99
- };
100
- }
89
+ // Validate required parameters
90
+ if (!args.gameObjectName) {
91
+ return {
92
+ content: [
93
+ {
94
+ type: 'text',
95
+ text: 'Failed to get animator state: gameObjectName is required'
96
+ }
97
+ ],
98
+ isError: true
99
+ };
100
+ }
101
101
 
102
- // Send command to Unity
103
- const result = await unityConnection.sendCommand('analysis_animator_state_get', args);
102
+ // Send command to Unity
103
+ const result = await unityConnection.sendCommand('analysis_animator_state_get', args);
104
104
 
105
- // Check for errors
106
- if (!result || typeof result === 'string') {
107
- return {
108
- content: [
109
- {
110
- type: 'text',
111
- text: `Failed to get animator state: Invalid response format`
112
- }
113
- ],
114
- isError: true
115
- };
116
- }
105
+ // Check for errors
106
+ if (!result || typeof result === 'string') {
107
+ return {
108
+ content: [
109
+ {
110
+ type: 'text',
111
+ text: `Failed to get animator state: Invalid response format`
112
+ }
113
+ ],
114
+ isError: true
115
+ };
116
+ }
117
117
 
118
- if (result.error) {
119
- return {
120
- content: [
121
- {
122
- type: 'text',
123
- text: `Failed to get animator state: ${result.error}`
124
- }
125
- ],
126
- isError: true
127
- };
128
- }
118
+ if (result.error) {
119
+ return {
120
+ content: [
121
+ {
122
+ type: 'text',
123
+ text: `Failed to get animator state: ${result.error}`
124
+ }
125
+ ],
126
+ isError: true
127
+ };
128
+ }
129
129
 
130
- // Format the response
131
- let text = result.summary || `Animator state retrieved for '${args.gameObjectName}'`;
132
-
133
- if (result.controllerName) {
134
- text += `\nController: ${result.controllerName}`;
135
- }
130
+ // Format the response
131
+ let text = result.summary || `Animator state retrieved for '${args.gameObjectName}'`;
132
+
133
+ if (result.controllerName) {
134
+ text += `\nController: ${result.controllerName}`;
135
+ }
136
136
 
137
- if (result.layers && Array.isArray(result.layers)) {
138
- text += `\n\n## Layer States:`;
139
- result.layers.forEach(layer => {
140
- text += `\n\n### Layer ${layer.layerIndex}: ${layer.layerName || 'Base Layer'}`;
141
- text += `\n- Weight: ${layer.layerWeight}`;
142
-
143
- if (layer.currentState) {
144
- text += `\n- Current State: ${layer.currentState.name || `Hash: ${layer.currentState.fullPathHash}`}`;
145
- text += `\n - Normalized Time: ${layer.currentState.normalizedTime?.toFixed(3)}`;
146
- text += `\n - Speed: ${layer.currentState.speed}`;
147
- if (layer.currentState.motion) {
148
- text += `\n - Motion: ${layer.currentState.motion}`;
149
- }
150
- }
137
+ if (result.layers && Array.isArray(result.layers)) {
138
+ text += `\n\n## Layer States:`;
139
+ result.layers.forEach(layer => {
140
+ text += `\n\n### Layer ${layer.layerIndex}: ${layer.layerName || 'Base Layer'}`;
141
+ text += `\n- Weight: ${layer.layerWeight}`;
151
142
 
152
- if (layer.activeTransition) {
153
- text += `\n- Active Transition:`;
154
- text += `\n - Duration: ${layer.activeTransition.duration}`;
155
- text += `\n - Progress: ${(layer.activeTransition.normalizedTime * 100).toFixed(1)}%`;
156
- if (layer.activeTransition.nextState) {
157
- text += `\n - To: ${layer.activeTransition.nextState.name || 'Unknown'}`;
158
- }
159
- }
160
- });
143
+ if (layer.currentState) {
144
+ text += `\n- Current State: ${layer.currentState.name || `Hash: ${layer.currentState.fullPathHash}`}`;
145
+ text += `\n - Normalized Time: ${layer.currentState.normalizedTime?.toFixed(3)}`;
146
+ text += `\n - Speed: ${layer.currentState.speed}`;
147
+ if (layer.currentState.motion) {
148
+ text += `\n - Motion: ${layer.currentState.motion}`;
149
+ }
161
150
  }
162
151
 
163
- if (result.parameters && Object.keys(result.parameters).length > 0) {
164
- text += `\n\n## Parameters:`;
165
- for (const [name, param] of Object.entries(result.parameters)) {
166
- text += `\n- ${name} (${param.type}): ${param.value}`;
167
- if (param.defaultValue !== undefined && param.type !== 'Trigger') {
168
- text += ` [default: ${param.defaultValue}]`;
169
- }
170
- }
152
+ if (layer.activeTransition) {
153
+ text += `\n- Active Transition:`;
154
+ text += `\n - Duration: ${layer.activeTransition.duration}`;
155
+ text += `\n - Progress: ${(layer.activeTransition.normalizedTime * 100).toFixed(1)}%`;
156
+ if (layer.activeTransition.nextState) {
157
+ text += `\n - To: ${layer.activeTransition.nextState.name || 'Unknown'}`;
158
+ }
171
159
  }
160
+ });
161
+ }
172
162
 
173
- return {
174
- content: [
175
- {
176
- type: 'text',
177
- text: text
178
- }
179
- ],
180
- isError: false
181
- };
182
- } catch (error) {
183
- return {
184
- content: [
185
- {
186
- type: 'text',
187
- text: `Failed to get animator state: ${error.message}`
188
- }
189
- ],
190
- isError: true
191
- };
163
+ if (result.parameters && Object.keys(result.parameters).length > 0) {
164
+ text += `\n\n## Parameters:`;
165
+ for (const [name, param] of Object.entries(result.parameters)) {
166
+ text += `\n- ${name} (${param.type}): ${param.value}`;
167
+ if (param.defaultValue !== undefined && param.type !== 'Trigger') {
168
+ text += ` [default: ${param.defaultValue}]`;
169
+ }
170
+ }
192
171
  }
172
+
173
+ return {
174
+ content: [
175
+ {
176
+ type: 'text',
177
+ text: text
178
+ }
179
+ ],
180
+ isError: false
181
+ };
182
+ } catch (error) {
183
+ return {
184
+ content: [
185
+ {
186
+ type: 'text',
187
+ text: `Failed to get animator state: ${error.message}`
188
+ }
189
+ ],
190
+ isError: true
191
+ };
192
+ }
193
193
  }
194
194
 
195
195
  // Handler for get_animator_runtime_info
196
196
  export async function getAnimatorRuntimeInfoHandler(unityConnection, args) {
197
- try {
198
- // Check connection
199
- if (!unityConnection.isConnected()) {
200
- return {
201
- content: [
202
- {
203
- type: 'text',
204
- text: 'Failed to get animator runtime info: Unity connection not available'
205
- }
206
- ],
207
- isError: true
208
- };
209
- }
197
+ try {
198
+ // Check connection
199
+ if (!unityConnection.isConnected()) {
200
+ return {
201
+ content: [
202
+ {
203
+ type: 'text',
204
+ text: 'Failed to get animator runtime info: Unity connection not available'
205
+ }
206
+ ],
207
+ isError: true
208
+ };
209
+ }
210
210
 
211
- // Validate required parameters
212
- if (!args.gameObjectName) {
213
- return {
214
- content: [
215
- {
216
- type: 'text',
217
- text: 'Failed to get animator runtime info: gameObjectName is required'
218
- }
219
- ],
220
- isError: true
221
- };
222
- }
211
+ // Validate required parameters
212
+ if (!args.gameObjectName) {
213
+ return {
214
+ content: [
215
+ {
216
+ type: 'text',
217
+ text: 'Failed to get animator runtime info: gameObjectName is required'
218
+ }
219
+ ],
220
+ isError: true
221
+ };
222
+ }
223
223
 
224
- // Send command to Unity
225
- const result = await unityConnection.sendCommand('analysis_animator_runtime_info_get', args);
224
+ // Send command to Unity
225
+ const result = await unityConnection.sendCommand('analysis_animator_runtime_info_get', args);
226
226
 
227
- // Check for errors
228
- if (!result || typeof result === 'string') {
229
- return {
230
- content: [
231
- {
232
- type: 'text',
233
- text: `Failed to get animator runtime info: Invalid response format`
234
- }
235
- ],
236
- isError: true
237
- };
238
- }
227
+ // Check for errors
228
+ if (!result || typeof result === 'string') {
229
+ return {
230
+ content: [
231
+ {
232
+ type: 'text',
233
+ text: `Failed to get animator runtime info: Invalid response format`
234
+ }
235
+ ],
236
+ isError: true
237
+ };
238
+ }
239
239
 
240
- if (result.error) {
241
- return {
242
- content: [
243
- {
244
- type: 'text',
245
- text: `Failed to get animator runtime info: ${result.error}`
246
- }
247
- ],
248
- isError: true
249
- };
250
- }
240
+ if (result.error) {
241
+ return {
242
+ content: [
243
+ {
244
+ type: 'text',
245
+ text: `Failed to get animator runtime info: ${result.error}`
246
+ }
247
+ ],
248
+ isError: true
249
+ };
250
+ }
251
251
 
252
- // Format the response
253
- let text = result.summary || `Animator runtime info retrieved for '${args.gameObjectName}'`;
254
-
255
- text += `\n\n## General Info:`;
256
- text += `\n- Controller: ${result.runtimeAnimatorController || 'None'}`;
257
- text += `\n- Update Mode: ${result.updateMode}`;
258
- text += `\n- Culling Mode: ${result.cullingMode}`;
259
- text += `\n- Speed: ${result.speed}`;
260
- text += `\n- Playback Time: ${result.playbackTime?.toFixed(3)}`;
252
+ // Format the response
253
+ let text = result.summary || `Animator runtime info retrieved for '${args.gameObjectName}'`;
261
254
 
262
- if (result.avatar) {
263
- text += `\n\n## Avatar:`;
264
- text += `\n- Name: ${result.avatar.name}`;
265
- text += `\n- Valid: ${result.avatar.isValid}`;
266
- text += `\n- Human: ${result.avatar.isHuman}`;
267
- }
255
+ text += `\n\n## General Info:`;
256
+ text += `\n- Controller: ${result.runtimeAnimatorController || 'None'}`;
257
+ text += `\n- Update Mode: ${result.updateMode}`;
258
+ text += `\n- Culling Mode: ${result.cullingMode}`;
259
+ text += `\n- Speed: ${result.speed}`;
260
+ text += `\n- Playback Time: ${result.playbackTime?.toFixed(3)}`;
268
261
 
269
- if (result.rootMotion) {
270
- text += `\n\n## Root Motion:`;
271
- text += `\n- Apply Root Motion: ${result.rootMotion.applyRootMotion}`;
272
- text += `\n- Has Root Motion: ${result.rootMotion.hasRootMotion}`;
273
- text += `\n- Velocity: (${result.rootMotion.velocity.x?.toFixed(2)}, ${result.rootMotion.velocity.y?.toFixed(2)}, ${result.rootMotion.velocity.z?.toFixed(2)})`;
274
- text += `\n- Angular Velocity: (${result.rootMotion.angularVelocity.x?.toFixed(2)}, ${result.rootMotion.angularVelocity.y?.toFixed(2)}, ${result.rootMotion.angularVelocity.z?.toFixed(2)})`;
275
- }
262
+ if (result.avatar) {
263
+ text += `\n\n## Avatar:`;
264
+ text += `\n- Name: ${result.avatar.name}`;
265
+ text += `\n- Valid: ${result.avatar.isValid}`;
266
+ text += `\n- Human: ${result.avatar.isHuman}`;
267
+ }
276
268
 
277
- if (result.ikInfo) {
278
- text += `\n\n## IK Info:`;
279
- text += `\n- Human Scale: ${result.ikInfo.humanScale}`;
280
- text += `\n- Feet Pivot Active: ${result.ikInfo.feetPivotActive}`;
281
- text += `\n- Pivot Weight: ${result.ikInfo.pivotWeight}`;
282
-
283
- if (result.ikInfo.goals) {
284
- text += `\n\n### IK Goals:`;
285
- for (const [goal, data] of Object.entries(result.ikInfo.goals)) {
286
- text += `\n- ${goal}:`;
287
- text += `\n - Position Weight: ${data.positionWeight}`;
288
- text += `\n - Rotation Weight: ${data.rotationWeight}`;
289
- }
290
- }
291
- }
269
+ if (result.rootMotion) {
270
+ text += `\n\n## Root Motion:`;
271
+ text += `\n- Apply Root Motion: ${result.rootMotion.applyRootMotion}`;
272
+ text += `\n- Has Root Motion: ${result.rootMotion.hasRootMotion}`;
273
+ text += `\n- Velocity: (${result.rootMotion.velocity.x?.toFixed(2)}, ${result.rootMotion.velocity.y?.toFixed(2)}, ${result.rootMotion.velocity.z?.toFixed(2)})`;
274
+ text += `\n- Angular Velocity: (${result.rootMotion.angularVelocity.x?.toFixed(2)}, ${result.rootMotion.angularVelocity.y?.toFixed(2)}, ${result.rootMotion.angularVelocity.z?.toFixed(2)})`;
275
+ }
292
276
 
293
- if (result.behaviours && result.behaviours.length > 0) {
294
- text += `\n\n## State Machine Behaviours:`;
295
- result.behaviours.forEach(behaviour => {
296
- text += `\n- Layer ${behaviour.layer}: ${behaviour.type} (${behaviour.enabled ? 'Enabled' : 'Disabled'})`;
297
- });
298
- }
277
+ if (result.ikInfo) {
278
+ text += `\n\n## IK Info:`;
279
+ text += `\n- Human Scale: ${result.ikInfo.humanScale}`;
280
+ text += `\n- Feet Pivot Active: ${result.ikInfo.feetPivotActive}`;
281
+ text += `\n- Pivot Weight: ${result.ikInfo.pivotWeight}`;
299
282
 
300
- text += `\n\n## Performance:`;
301
- text += `\n- Has Bound Playables: ${result.hasBoundPlayables}`;
302
- text += `\n- Has Transform Hierarchy: ${result.hasTransformHierarchy}`;
303
- text += `\n- Is Optimizable: ${result.isOptimizable}`;
304
- text += `\n- Gravity Weight: ${result.gravityWeight}`;
283
+ if (result.ikInfo.goals) {
284
+ text += `\n\n### IK Goals:`;
285
+ for (const [goal, data] of Object.entries(result.ikInfo.goals)) {
286
+ text += `\n- ${goal}:`;
287
+ text += `\n - Position Weight: ${data.positionWeight}`;
288
+ text += `\n - Rotation Weight: ${data.rotationWeight}`;
289
+ }
290
+ }
291
+ }
305
292
 
306
- return {
307
- content: [
308
- {
309
- type: 'text',
310
- text: text
311
- }
312
- ],
313
- isError: false
314
- };
315
- } catch (error) {
316
- return {
317
- content: [
318
- {
319
- type: 'text',
320
- text: `Failed to get animator runtime info: ${error.message}`
321
- }
322
- ],
323
- isError: true
324
- };
293
+ if (result.behaviours && result.behaviours.length > 0) {
294
+ text += `\n\n## State Machine Behaviours:`;
295
+ result.behaviours.forEach(behaviour => {
296
+ text += `\n- Layer ${behaviour.layer}: ${behaviour.type} (${behaviour.enabled ? 'Enabled' : 'Disabled'})`;
297
+ });
325
298
  }
299
+
300
+ text += `\n\n## Performance:`;
301
+ text += `\n- Has Bound Playables: ${result.hasBoundPlayables}`;
302
+ text += `\n- Has Transform Hierarchy: ${result.hasTransformHierarchy}`;
303
+ text += `\n- Is Optimizable: ${result.isOptimizable}`;
304
+ text += `\n- Gravity Weight: ${result.gravityWeight}`;
305
+
306
+ return {
307
+ content: [
308
+ {
309
+ type: 'text',
310
+ text: text
311
+ }
312
+ ],
313
+ isError: false
314
+ };
315
+ } catch (error) {
316
+ return {
317
+ content: [
318
+ {
319
+ type: 'text',
320
+ text: `Failed to get animator runtime info: ${error.message}`
321
+ }
322
+ ],
323
+ isError: true
324
+ };
325
+ }
326
326
  }