@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,99 +2,99 @@
2
2
  * Tool definition for analysis_scene_contents_analyze
3
3
  */
4
4
  export const analyzeSceneContentsToolDefinition = {
5
- name: 'analysis_scene_contents_analyze',
6
- description: 'Analyze current scene: object counts, types, prefabs, and memory stats.',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {
10
- includeInactive: {
11
- type: 'boolean',
12
- description: 'Include inactive objects in analysis. Default: true'
13
- },
14
- groupByType: {
15
- type: 'boolean',
16
- description: 'Group results by component types. Default: true'
17
- },
18
- includePrefabInfo: {
19
- type: 'boolean',
20
- description: 'Include prefab connection info. Default: true'
21
- },
22
- includeMemoryInfo: {
23
- type: 'boolean',
24
- description: 'Include memory usage estimates. Default: false'
25
- }
26
- },
27
- required: []
28
- }
5
+ name: 'analysis_scene_contents_analyze',
6
+ description: 'Analyze current scene: object counts, types, prefabs, and memory stats.',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ includeInactive: {
11
+ type: 'boolean',
12
+ description: 'Include inactive objects in analysis. Default: true'
13
+ },
14
+ groupByType: {
15
+ type: 'boolean',
16
+ description: 'Group results by component types. Default: true'
17
+ },
18
+ includePrefabInfo: {
19
+ type: 'boolean',
20
+ description: 'Include prefab connection info. Default: true'
21
+ },
22
+ includeMemoryInfo: {
23
+ type: 'boolean',
24
+ description: 'Include memory usage estimates. Default: false'
25
+ }
26
+ },
27
+ required: []
28
+ }
29
29
  };
30
30
 
31
31
  /**
32
32
  * Handler for analyze_scene_contents tool
33
33
  */
34
34
  export async function analyzeSceneContentsHandler(unityConnection, args) {
35
- try {
36
- // Check connection
37
- if (!unityConnection.isConnected()) {
38
- return {
39
- content: [
40
- {
41
- type: 'text',
42
- text: 'Failed to analyze scene: Unity connection not available'
43
- }
44
- ],
45
- isError: true
46
- };
47
- }
48
-
49
- // Send command to Unity with provided parameters
50
- const result = await unityConnection.sendCommand('analysis_scene_contents_analyze', args);
35
+ try {
36
+ // Check connection
37
+ if (!unityConnection.isConnected()) {
38
+ return {
39
+ content: [
40
+ {
41
+ type: 'text',
42
+ text: 'Failed to analyze scene: Unity connection not available'
43
+ }
44
+ ],
45
+ isError: true
46
+ };
47
+ }
51
48
 
52
- // The unityConnection.sendCommand already extracts the result field
53
- // from the response, so we access properties directly on result
54
- if (!result || typeof result === 'string') {
55
- return {
56
- content: [
57
- {
58
- type: 'text',
59
- text: `Failed to analyze scene: Invalid response format`
60
- }
61
- ],
62
- isError: true
63
- };
64
- }
49
+ // Send command to Unity with provided parameters
50
+ const result = await unityConnection.sendCommand('analysis_scene_contents_analyze', args);
65
51
 
66
- // Check if result has error property (error response from Unity)
67
- if (result.error) {
68
- return {
69
- content: [
70
- {
71
- type: 'text',
72
- text: `Failed to analyze scene: ${result.error}`
73
- }
74
- ],
75
- isError: true
76
- };
77
- }
52
+ // The unityConnection.sendCommand already extracts the result field
53
+ // from the response, so we access properties directly on result
54
+ if (!result || typeof result === 'string') {
55
+ return {
56
+ content: [
57
+ {
58
+ type: 'text',
59
+ text: `Failed to analyze scene: Invalid response format`
60
+ }
61
+ ],
62
+ isError: true
63
+ };
64
+ }
78
65
 
79
- // Success response - result is already the unwrapped data
80
- return {
81
- content: [
82
- {
83
- type: 'text',
84
- text: result.summary || 'Scene analysis complete'
85
- }
86
- ],
87
- isError: false
88
- };
89
- } catch (error) {
90
- return {
91
- content: [
92
- {
93
- type: 'text',
94
- text: `Failed to analyze scene: ${error.message}`
95
- }
96
- ],
97
- isError: true
98
- };
66
+ // Check if result has error property (error response from Unity)
67
+ if (result.error) {
68
+ return {
69
+ content: [
70
+ {
71
+ type: 'text',
72
+ text: `Failed to analyze scene: ${result.error}`
73
+ }
74
+ ],
75
+ isError: true
76
+ };
99
77
  }
78
+
79
+ // Success response - result is already the unwrapped data
80
+ return {
81
+ content: [
82
+ {
83
+ type: 'text',
84
+ text: result.summary || 'Scene analysis complete'
85
+ }
86
+ ],
87
+ isError: false
88
+ };
89
+ } catch (error) {
90
+ return {
91
+ content: [
92
+ {
93
+ type: 'text',
94
+ text: `Failed to analyze scene: ${error.message}`
95
+ }
96
+ ],
97
+ isError: true
98
+ };
99
+ }
100
100
  }
@@ -2,86 +2,86 @@
2
2
  * Tool definition for analysis_component_find
3
3
  */
4
4
  export const findByComponentToolDefinition = {
5
- name: 'analysis_component_find',
6
- description: 'Find GameObjects that have a specific component type (scene/prefabs/all).',
7
- inputSchema: {
8
- type: 'object',
9
- properties: {
10
- componentType: {
11
- type: 'string',
12
- description: 'Component type to search for (e.g., "Light", "Collider", "AudioSource")'
13
- },
14
- includeInactive: {
15
- type: 'boolean',
16
- description: 'Include inactive GameObjects. Default: true'
17
- },
18
- searchScope: {
19
- type: 'string',
20
- enum: ['scene', 'prefabs', 'all'],
21
- description: 'Where to search: current scene, prefabs, or all. Default: "scene"'
22
- },
23
- matchExactType: {
24
- type: 'boolean',
25
- description: 'Match exact type only (not derived types). Default: true'
26
- }
27
- },
28
- required: ['componentType']
29
- }
5
+ name: 'analysis_component_find',
6
+ description: 'Find GameObjects that have a specific component type (scene/prefabs/all).',
7
+ inputSchema: {
8
+ type: 'object',
9
+ properties: {
10
+ componentType: {
11
+ type: 'string',
12
+ description: 'Component type to search for (e.g., "Light", "Collider", "AudioSource")'
13
+ },
14
+ includeInactive: {
15
+ type: 'boolean',
16
+ description: 'Include inactive GameObjects. Default: true'
17
+ },
18
+ searchScope: {
19
+ type: 'string',
20
+ enum: ['scene', 'prefabs', 'all'],
21
+ description: 'Where to search: current scene, prefabs, or all. Default: "scene"'
22
+ },
23
+ matchExactType: {
24
+ type: 'boolean',
25
+ description: 'Match exact type only (not derived types). Default: true'
26
+ }
27
+ },
28
+ required: ['componentType']
29
+ }
30
30
  };
31
31
 
32
32
  /**
33
33
  * Handler for find_by_component tool
34
34
  */
35
35
  export async function findByComponentHandler(unityConnection, args) {
36
- try {
37
- // Check connection
38
- if (!unityConnection.isConnected()) {
39
- return {
40
- content: [
41
- {
42
- type: 'text',
43
- text: 'Failed to find GameObjects: Unity connection not available'
44
- }
45
- ],
46
- isError: true
47
- };
48
- }
49
-
50
- // Send command to Unity
51
- const result = await unityConnection.sendCommand('analysis_component_find', args);
36
+ try {
37
+ // Check connection
38
+ if (!unityConnection.isConnected()) {
39
+ return {
40
+ content: [
41
+ {
42
+ type: 'text',
43
+ text: 'Failed to find GameObjects: Unity connection not available'
44
+ }
45
+ ],
46
+ isError: true
47
+ };
48
+ }
52
49
 
53
- // Handle Unity response
54
- if (result.status === 'error') {
55
- return {
56
- content: [
57
- {
58
- type: 'text',
59
- text: `Failed to find GameObjects: ${result.error}`
60
- }
61
- ],
62
- isError: true
63
- };
64
- }
50
+ // Send command to Unity
51
+ const result = await unityConnection.sendCommand('analysis_component_find', args);
65
52
 
66
- // Success response
67
- return {
68
- content: [
69
- {
70
- type: 'text',
71
- text: result.result.summary || `Found ${result.result.totalFound} GameObjects`
72
- }
73
- ],
74
- isError: false
75
- };
76
- } catch (error) {
77
- return {
78
- content: [
79
- {
80
- type: 'text',
81
- text: `Failed to find GameObjects: ${error.message}`
82
- }
83
- ],
84
- isError: true
85
- };
53
+ // Handle Unity response
54
+ if (result.status === 'error') {
55
+ return {
56
+ content: [
57
+ {
58
+ type: 'text',
59
+ text: `Failed to find GameObjects: ${result.error}`
60
+ }
61
+ ],
62
+ isError: true
63
+ };
86
64
  }
65
+
66
+ // Success response
67
+ return {
68
+ content: [
69
+ {
70
+ type: 'text',
71
+ text: result.result.summary || `Found ${result.result.totalFound} GameObjects`
72
+ }
73
+ ],
74
+ isError: false
75
+ };
76
+ } catch (error) {
77
+ return {
78
+ content: [
79
+ {
80
+ type: 'text',
81
+ text: `Failed to find GameObjects: ${error.message}`
82
+ }
83
+ ],
84
+ isError: true
85
+ };
86
+ }
87
87
  }