@akiojin/unity-mcp-server 2.14.14
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/LICENSE +21 -0
- package/README.md +206 -0
- package/bin/unity-mcp-server +2 -0
- package/package.json +73 -0
- package/src/core/codeIndex.js +163 -0
- package/src/core/codeIndexDb.js +96 -0
- package/src/core/config.js +165 -0
- package/src/core/indexWatcher.js +52 -0
- package/src/core/projectInfo.js +111 -0
- package/src/core/server.js +294 -0
- package/src/core/unityConnection.js +426 -0
- package/src/handlers/analysis/AnalyzeSceneContentsToolHandler.js +35 -0
- package/src/handlers/analysis/FindByComponentToolHandler.js +20 -0
- package/src/handlers/analysis/GetAnimatorStateToolHandler.js +37 -0
- package/src/handlers/analysis/GetComponentValuesToolHandler.js +20 -0
- package/src/handlers/analysis/GetGameObjectDetailsToolHandler.js +35 -0
- package/src/handlers/analysis/GetInputActionsStateToolHandler.js +37 -0
- package/src/handlers/analysis/GetObjectReferencesToolHandler.js +20 -0
- package/src/handlers/asset/AssetDatabaseToolHandler.js +221 -0
- package/src/handlers/asset/AssetDependencyToolHandler.js +201 -0
- package/src/handlers/asset/AssetImportSettingsToolHandler.js +170 -0
- package/src/handlers/asset/CreateMaterialToolHandler.js +96 -0
- package/src/handlers/asset/CreatePrefabToolHandler.js +78 -0
- package/src/handlers/asset/ExitPrefabModeToolHandler.js +83 -0
- package/src/handlers/asset/InstantiatePrefabToolHandler.js +133 -0
- package/src/handlers/asset/ModifyMaterialToolHandler.js +76 -0
- package/src/handlers/asset/ModifyPrefabToolHandler.js +72 -0
- package/src/handlers/asset/OpenPrefabToolHandler.js +121 -0
- package/src/handlers/asset/SavePrefabToolHandler.js +106 -0
- package/src/handlers/base/BaseToolHandler.js +133 -0
- package/src/handlers/compilation/GetCompilationStateToolHandler.js +90 -0
- package/src/handlers/component/AddComponentToolHandler.js +126 -0
- package/src/handlers/component/GetComponentTypesToolHandler.js +100 -0
- package/src/handlers/component/ListComponentsToolHandler.js +85 -0
- package/src/handlers/component/ModifyComponentToolHandler.js +143 -0
- package/src/handlers/component/RemoveComponentToolHandler.js +108 -0
- package/src/handlers/console/ClearConsoleToolHandler.js +160 -0
- package/src/handlers/console/ReadConsoleToolHandler.js +276 -0
- package/src/handlers/editor/LayerManagementToolHandler.js +160 -0
- package/src/handlers/editor/SelectionToolHandler.js +141 -0
- package/src/handlers/editor/TagManagementToolHandler.js +129 -0
- package/src/handlers/editor/ToolManagementToolHandler.js +135 -0
- package/src/handlers/editor/WindowManagementToolHandler.js +125 -0
- package/src/handlers/gameobject/CreateGameObjectToolHandler.js +131 -0
- package/src/handlers/gameobject/DeleteGameObjectToolHandler.js +101 -0
- package/src/handlers/gameobject/FindGameObjectToolHandler.js +119 -0
- package/src/handlers/gameobject/GetHierarchyToolHandler.js +132 -0
- package/src/handlers/gameobject/ModifyGameObjectToolHandler.js +128 -0
- package/src/handlers/index.js +389 -0
- package/src/handlers/input/AddInputActionToolHandler.js +20 -0
- package/src/handlers/input/AddInputBindingToolHandler.js +20 -0
- package/src/handlers/input/CreateActionMapToolHandler.js +20 -0
- package/src/handlers/input/CreateCompositeBindingToolHandler.js +20 -0
- package/src/handlers/input/GamepadSimulationHandler.js +116 -0
- package/src/handlers/input/InputSystemHandler.js +80 -0
- package/src/handlers/input/KeyboardSimulationHandler.js +79 -0
- package/src/handlers/input/ManageControlSchemesToolHandler.js +20 -0
- package/src/handlers/input/MouseSimulationHandler.js +107 -0
- package/src/handlers/input/RemoveActionMapToolHandler.js +20 -0
- package/src/handlers/input/RemoveAllBindingsToolHandler.js +20 -0
- package/src/handlers/input/RemoveInputActionToolHandler.js +20 -0
- package/src/handlers/input/RemoveInputBindingToolHandler.js +20 -0
- package/src/handlers/input/TouchSimulationHandler.js +142 -0
- package/src/handlers/menu/ExecuteMenuItemToolHandler.js +304 -0
- package/src/handlers/package/PackageManagerToolHandler.js +248 -0
- package/src/handlers/package/RegistryConfigToolHandler.js +198 -0
- package/src/handlers/playmode/GetEditorStateToolHandler.js +81 -0
- package/src/handlers/playmode/PauseToolHandler.js +44 -0
- package/src/handlers/playmode/PlayToolHandler.js +91 -0
- package/src/handlers/playmode/StopToolHandler.js +77 -0
- package/src/handlers/playmode/WaitForEditorStateToolHandler.js +45 -0
- package/src/handlers/scene/CreateSceneToolHandler.js +91 -0
- package/src/handlers/scene/GetSceneInfoToolHandler.js +20 -0
- package/src/handlers/scene/ListScenesToolHandler.js +58 -0
- package/src/handlers/scene/LoadSceneToolHandler.js +92 -0
- package/src/handlers/scene/SaveSceneToolHandler.js +76 -0
- package/src/handlers/screenshot/AnalyzeScreenshotToolHandler.js +238 -0
- package/src/handlers/screenshot/CaptureScreenshotToolHandler.js +692 -0
- package/src/handlers/script/BuildCodeIndexToolHandler.js +163 -0
- package/src/handlers/script/ScriptCreateClassFileToolHandler.js +60 -0
- package/src/handlers/script/ScriptEditStructuredToolHandler.js +173 -0
- package/src/handlers/script/ScriptIndexStatusToolHandler.js +61 -0
- package/src/handlers/script/ScriptPackagesListToolHandler.js +103 -0
- package/src/handlers/script/ScriptReadToolHandler.js +106 -0
- package/src/handlers/script/ScriptRefactorRenameToolHandler.js +83 -0
- package/src/handlers/script/ScriptRefsFindToolHandler.js +144 -0
- package/src/handlers/script/ScriptRemoveSymbolToolHandler.js +79 -0
- package/src/handlers/script/ScriptSearchToolHandler.js +320 -0
- package/src/handlers/script/ScriptSymbolFindToolHandler.js +117 -0
- package/src/handlers/script/ScriptSymbolsGetToolHandler.js +96 -0
- package/src/handlers/settings/GetProjectSettingsToolHandler.js +161 -0
- package/src/handlers/settings/UpdateProjectSettingsToolHandler.js +272 -0
- package/src/handlers/system/GetCommandStatsToolHandler.js +25 -0
- package/src/handlers/system/PingToolHandler.js +53 -0
- package/src/handlers/system/RefreshAssetsToolHandler.js +45 -0
- package/src/handlers/ui/ClickUIElementToolHandler.js +110 -0
- package/src/handlers/ui/FindUIElementsToolHandler.js +63 -0
- package/src/handlers/ui/GetUIElementStateToolHandler.js +50 -0
- package/src/handlers/ui/SetUIElementValueToolHandler.js +49 -0
- package/src/handlers/ui/SimulateUIInputToolHandler.js +156 -0
- package/src/handlers/video/CaptureVideoForToolHandler.js +96 -0
- package/src/handlers/video/CaptureVideoStartToolHandler.js +38 -0
- package/src/handlers/video/CaptureVideoStatusToolHandler.js +30 -0
- package/src/handlers/video/CaptureVideoStopToolHandler.js +32 -0
- package/src/lsp/CSharpLspUtils.js +134 -0
- package/src/lsp/LspProcessManager.js +60 -0
- package/src/lsp/LspRpcClient.js +133 -0
- package/src/tools/analysis/analyzeSceneContents.js +100 -0
- package/src/tools/analysis/findByComponent.js +87 -0
- package/src/tools/analysis/getAnimatorState.js +326 -0
- package/src/tools/analysis/getComponentValues.js +182 -0
- package/src/tools/analysis/getGameObjectDetails.js +159 -0
- package/src/tools/analysis/getInputActionsState.js +329 -0
- package/src/tools/analysis/getObjectReferences.js +86 -0
- package/src/tools/input/inputActionsEditor.js +556 -0
- package/src/tools/scene/createScene.js +112 -0
- package/src/tools/scene/getSceneInfo.js +95 -0
- package/src/tools/scene/listScenes.js +82 -0
- package/src/tools/scene/loadScene.js +122 -0
- package/src/tools/scene/saveScene.js +91 -0
- package/src/tools/system/ping.js +72 -0
- package/src/tools/video/recordFor.js +31 -0
- package/src/tools/video/recordPlayMode.js +61 -0
- package/src/utils/csharpParse.js +88 -0
- package/src/utils/validators.js +90 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central export and registration for all tool handlers
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Export all handlers
|
|
6
|
+
export { BaseToolHandler } from './base/BaseToolHandler.js';
|
|
7
|
+
|
|
8
|
+
// System handlers
|
|
9
|
+
export { PingToolHandler } from './system/PingToolHandler.js';
|
|
10
|
+
export { RefreshAssetsToolHandler } from './system/RefreshAssetsToolHandler.js';
|
|
11
|
+
export { GetCommandStatsToolHandler } from './system/GetCommandStatsToolHandler.js';
|
|
12
|
+
|
|
13
|
+
// GameObject handlers
|
|
14
|
+
export { CreateGameObjectToolHandler } from './gameobject/CreateGameObjectToolHandler.js';
|
|
15
|
+
export { FindGameObjectToolHandler } from './gameobject/FindGameObjectToolHandler.js';
|
|
16
|
+
export { ModifyGameObjectToolHandler } from './gameobject/ModifyGameObjectToolHandler.js';
|
|
17
|
+
export { DeleteGameObjectToolHandler } from './gameobject/DeleteGameObjectToolHandler.js';
|
|
18
|
+
export { GetHierarchyToolHandler } from './gameobject/GetHierarchyToolHandler.js';
|
|
19
|
+
|
|
20
|
+
// Scene handlers
|
|
21
|
+
export { CreateSceneToolHandler } from './scene/CreateSceneToolHandler.js';
|
|
22
|
+
export { LoadSceneToolHandler } from './scene/LoadSceneToolHandler.js';
|
|
23
|
+
export { SaveSceneToolHandler } from './scene/SaveSceneToolHandler.js';
|
|
24
|
+
export { ListScenesToolHandler } from './scene/ListScenesToolHandler.js';
|
|
25
|
+
export { GetSceneInfoToolHandler } from './scene/GetSceneInfoToolHandler.js';
|
|
26
|
+
|
|
27
|
+
// Analysis handlers
|
|
28
|
+
export { GetGameObjectDetailsToolHandler } from './analysis/GetGameObjectDetailsToolHandler.js';
|
|
29
|
+
export { AnalyzeSceneContentsToolHandler } from './analysis/AnalyzeSceneContentsToolHandler.js';
|
|
30
|
+
export { GetComponentValuesToolHandler } from './analysis/GetComponentValuesToolHandler.js';
|
|
31
|
+
export { FindByComponentToolHandler } from './analysis/FindByComponentToolHandler.js';
|
|
32
|
+
export { GetObjectReferencesToolHandler } from './analysis/GetObjectReferencesToolHandler.js';
|
|
33
|
+
export { GetAnimatorStateToolHandler, GetAnimatorRuntimeInfoToolHandler } from './analysis/GetAnimatorStateToolHandler.js';
|
|
34
|
+
export { GetInputActionsStateToolHandler, AnalyzeInputActionsAssetToolHandler } from './analysis/GetInputActionsStateToolHandler.js';
|
|
35
|
+
|
|
36
|
+
// PlayMode handlers
|
|
37
|
+
export { PlayToolHandler } from './playmode/PlayToolHandler.js';
|
|
38
|
+
export { PauseToolHandler } from './playmode/PauseToolHandler.js';
|
|
39
|
+
export { StopToolHandler } from './playmode/StopToolHandler.js';
|
|
40
|
+
export { GetEditorStateToolHandler } from './playmode/GetEditorStateToolHandler.js';
|
|
41
|
+
export { WaitForEditorStateToolHandler } from './playmode/WaitForEditorStateToolHandler.js';
|
|
42
|
+
|
|
43
|
+
// UI handlers
|
|
44
|
+
export { FindUIElementsToolHandler } from './ui/FindUIElementsToolHandler.js';
|
|
45
|
+
export { ClickUIElementToolHandler } from './ui/ClickUIElementToolHandler.js';
|
|
46
|
+
export { GetUIElementStateToolHandler } from './ui/GetUIElementStateToolHandler.js';
|
|
47
|
+
export { SetUIElementValueToolHandler } from './ui/SetUIElementValueToolHandler.js';
|
|
48
|
+
export { SimulateUIInputToolHandler } from './ui/SimulateUIInputToolHandler.js';
|
|
49
|
+
|
|
50
|
+
// Input System handlers
|
|
51
|
+
export { InputSystemHandler } from './input/InputSystemHandler.js';
|
|
52
|
+
export { KeyboardSimulationHandler } from './input/KeyboardSimulationHandler.js';
|
|
53
|
+
export { MouseSimulationHandler } from './input/MouseSimulationHandler.js';
|
|
54
|
+
export { GamepadSimulationHandler } from './input/GamepadSimulationHandler.js';
|
|
55
|
+
export { TouchSimulationHandler } from './input/TouchSimulationHandler.js';
|
|
56
|
+
export { CreateActionMapToolHandler } from './input/CreateActionMapToolHandler.js';
|
|
57
|
+
export { RemoveActionMapToolHandler } from './input/RemoveActionMapToolHandler.js';
|
|
58
|
+
export { AddInputActionToolHandler } from './input/AddInputActionToolHandler.js';
|
|
59
|
+
export { RemoveInputActionToolHandler } from './input/RemoveInputActionToolHandler.js';
|
|
60
|
+
export { AddInputBindingToolHandler } from './input/AddInputBindingToolHandler.js';
|
|
61
|
+
export { RemoveInputBindingToolHandler } from './input/RemoveInputBindingToolHandler.js';
|
|
62
|
+
export { RemoveAllBindingsToolHandler } from './input/RemoveAllBindingsToolHandler.js';
|
|
63
|
+
export { CreateCompositeBindingToolHandler } from './input/CreateCompositeBindingToolHandler.js';
|
|
64
|
+
export { ManageControlSchemesToolHandler } from './input/ManageControlSchemesToolHandler.js';
|
|
65
|
+
|
|
66
|
+
// Asset handlers
|
|
67
|
+
export { CreatePrefabToolHandler } from './asset/CreatePrefabToolHandler.js';
|
|
68
|
+
export { ModifyPrefabToolHandler } from './asset/ModifyPrefabToolHandler.js';
|
|
69
|
+
export { InstantiatePrefabToolHandler } from './asset/InstantiatePrefabToolHandler.js';
|
|
70
|
+
export { CreateMaterialToolHandler } from './asset/CreateMaterialToolHandler.js';
|
|
71
|
+
export { ModifyMaterialToolHandler } from './asset/ModifyMaterialToolHandler.js';
|
|
72
|
+
export { OpenPrefabToolHandler } from './asset/OpenPrefabToolHandler.js';
|
|
73
|
+
export { ExitPrefabModeToolHandler } from './asset/ExitPrefabModeToolHandler.js';
|
|
74
|
+
export { SavePrefabToolHandler } from './asset/SavePrefabToolHandler.js';
|
|
75
|
+
export { AssetImportSettingsToolHandler } from './asset/AssetImportSettingsToolHandler.js';
|
|
76
|
+
export { AssetDatabaseToolHandler } from './asset/AssetDatabaseToolHandler.js';
|
|
77
|
+
export { AssetDependencyToolHandler } from './asset/AssetDependencyToolHandler.js';
|
|
78
|
+
|
|
79
|
+
// Menu handlers
|
|
80
|
+
export { ExecuteMenuItemToolHandler } from './menu/ExecuteMenuItemToolHandler.js';
|
|
81
|
+
|
|
82
|
+
// Console handlers
|
|
83
|
+
export { ClearConsoleToolHandler } from './console/ClearConsoleToolHandler.js';
|
|
84
|
+
export { ReadConsoleToolHandler } from './console/ReadConsoleToolHandler.js';
|
|
85
|
+
|
|
86
|
+
// Screenshot handlers
|
|
87
|
+
export { CaptureScreenshotToolHandler } from './screenshot/CaptureScreenshotToolHandler.js';
|
|
88
|
+
export { AnalyzeScreenshotToolHandler } from './screenshot/AnalyzeScreenshotToolHandler.js';
|
|
89
|
+
|
|
90
|
+
// Video handlers
|
|
91
|
+
export { CaptureVideoStartToolHandler } from './video/CaptureVideoStartToolHandler.js';
|
|
92
|
+
export { CaptureVideoStopToolHandler } from './video/CaptureVideoStopToolHandler.js';
|
|
93
|
+
export { CaptureVideoStatusToolHandler } from './video/CaptureVideoStatusToolHandler.js';
|
|
94
|
+
export { CaptureVideoForToolHandler } from './video/CaptureVideoForToolHandler.js';
|
|
95
|
+
|
|
96
|
+
// Component handlers
|
|
97
|
+
export { AddComponentToolHandler } from './component/AddComponentToolHandler.js';
|
|
98
|
+
export { RemoveComponentToolHandler } from './component/RemoveComponentToolHandler.js';
|
|
99
|
+
export { ModifyComponentToolHandler } from './component/ModifyComponentToolHandler.js';
|
|
100
|
+
export { ListComponentsToolHandler } from './component/ListComponentsToolHandler.js';
|
|
101
|
+
export { GetComponentTypesToolHandler } from './component/GetComponentTypesToolHandler.js';
|
|
102
|
+
|
|
103
|
+
// Compilation handlers
|
|
104
|
+
export { GetCompilationStateToolHandler } from './compilation/GetCompilationStateToolHandler.js';
|
|
105
|
+
|
|
106
|
+
// Editor control handlers
|
|
107
|
+
export { TagManagementToolHandler } from './editor/TagManagementToolHandler.js';
|
|
108
|
+
export { LayerManagementToolHandler } from './editor/LayerManagementToolHandler.js';
|
|
109
|
+
export { SelectionToolHandler } from './editor/SelectionToolHandler.js';
|
|
110
|
+
export { WindowManagementToolHandler } from './editor/WindowManagementToolHandler.js';
|
|
111
|
+
export { ToolManagementToolHandler } from './editor/ToolManagementToolHandler.js';
|
|
112
|
+
|
|
113
|
+
// Settings handlers
|
|
114
|
+
export { GetProjectSettingsToolHandler } from './settings/GetProjectSettingsToolHandler.js';
|
|
115
|
+
export { UpdateProjectSettingsToolHandler } from './settings/UpdateProjectSettingsToolHandler.js';
|
|
116
|
+
|
|
117
|
+
// Package management handlers
|
|
118
|
+
export { default as PackageManagerToolHandler } from './package/PackageManagerToolHandler.js';
|
|
119
|
+
export { default as RegistryConfigToolHandler } from './package/RegistryConfigToolHandler.js';
|
|
120
|
+
|
|
121
|
+
// Script handlers
|
|
122
|
+
export { ScriptPackagesListToolHandler } from './script/ScriptPackagesListToolHandler.js';
|
|
123
|
+
export { ScriptReadToolHandler } from './script/ScriptReadToolHandler.js';
|
|
124
|
+
export { ScriptSearchToolHandler } from './script/ScriptSearchToolHandler.js';
|
|
125
|
+
export { ScriptEditStructuredToolHandler } from './script/ScriptEditStructuredToolHandler.js';
|
|
126
|
+
export { ScriptRefsFindToolHandler } from './script/ScriptRefsFindToolHandler.js';
|
|
127
|
+
export { ScriptSymbolFindToolHandler } from './script/ScriptSymbolFindToolHandler.js';
|
|
128
|
+
export { ScriptSymbolsGetToolHandler } from './script/ScriptSymbolsGetToolHandler.js';
|
|
129
|
+
export { ScriptIndexStatusToolHandler } from './script/ScriptIndexStatusToolHandler.js';
|
|
130
|
+
export { ScriptRefactorRenameToolHandler } from './script/ScriptRefactorRenameToolHandler.js';
|
|
131
|
+
export { ScriptCreateClassFileToolHandler } from './script/ScriptCreateClassFileToolHandler.js';
|
|
132
|
+
export { ScriptRemoveSymbolToolHandler } from './script/ScriptRemoveSymbolToolHandler.js';
|
|
133
|
+
// Deprecated Unity-communication handlers removed: ScriptEditPatchToolHandler, ScriptReplacePatternToolHandler
|
|
134
|
+
// Script tool registry
|
|
135
|
+
|
|
136
|
+
// Import all handler classes at once
|
|
137
|
+
import { PingToolHandler } from './system/PingToolHandler.js';
|
|
138
|
+
import { RefreshAssetsToolHandler } from './system/RefreshAssetsToolHandler.js';
|
|
139
|
+
import { GetCommandStatsToolHandler } from './system/GetCommandStatsToolHandler.js';
|
|
140
|
+
import { CreateGameObjectToolHandler } from './gameobject/CreateGameObjectToolHandler.js';
|
|
141
|
+
import { FindGameObjectToolHandler } from './gameobject/FindGameObjectToolHandler.js';
|
|
142
|
+
import { ModifyGameObjectToolHandler } from './gameobject/ModifyGameObjectToolHandler.js';
|
|
143
|
+
import { DeleteGameObjectToolHandler } from './gameobject/DeleteGameObjectToolHandler.js';
|
|
144
|
+
import { GetHierarchyToolHandler } from './gameobject/GetHierarchyToolHandler.js';
|
|
145
|
+
import { CreateSceneToolHandler } from './scene/CreateSceneToolHandler.js';
|
|
146
|
+
import { LoadSceneToolHandler } from './scene/LoadSceneToolHandler.js';
|
|
147
|
+
import { SaveSceneToolHandler } from './scene/SaveSceneToolHandler.js';
|
|
148
|
+
import { ListScenesToolHandler } from './scene/ListScenesToolHandler.js';
|
|
149
|
+
import { GetSceneInfoToolHandler } from './scene/GetSceneInfoToolHandler.js';
|
|
150
|
+
import { GetGameObjectDetailsToolHandler } from './analysis/GetGameObjectDetailsToolHandler.js';
|
|
151
|
+
import { AnalyzeSceneContentsToolHandler } from './analysis/AnalyzeSceneContentsToolHandler.js';
|
|
152
|
+
import { GetComponentValuesToolHandler } from './analysis/GetComponentValuesToolHandler.js';
|
|
153
|
+
import { FindByComponentToolHandler } from './analysis/FindByComponentToolHandler.js';
|
|
154
|
+
import { GetObjectReferencesToolHandler } from './analysis/GetObjectReferencesToolHandler.js';
|
|
155
|
+
import { GetAnimatorStateToolHandler, GetAnimatorRuntimeInfoToolHandler } from './analysis/GetAnimatorStateToolHandler.js';
|
|
156
|
+
import { GetInputActionsStateToolHandler, AnalyzeInputActionsAssetToolHandler } from './analysis/GetInputActionsStateToolHandler.js';
|
|
157
|
+
import { PlayToolHandler } from './playmode/PlayToolHandler.js';
|
|
158
|
+
import { PauseToolHandler } from './playmode/PauseToolHandler.js';
|
|
159
|
+
import { StopToolHandler } from './playmode/StopToolHandler.js';
|
|
160
|
+
import { GetEditorStateToolHandler } from './playmode/GetEditorStateToolHandler.js';
|
|
161
|
+
import { WaitForEditorStateToolHandler } from './playmode/WaitForEditorStateToolHandler.js';
|
|
162
|
+
import { FindUIElementsToolHandler } from './ui/FindUIElementsToolHandler.js';
|
|
163
|
+
import { ClickUIElementToolHandler } from './ui/ClickUIElementToolHandler.js';
|
|
164
|
+
import { GetUIElementStateToolHandler } from './ui/GetUIElementStateToolHandler.js';
|
|
165
|
+
import { SetUIElementValueToolHandler } from './ui/SetUIElementValueToolHandler.js';
|
|
166
|
+
import { SimulateUIInputToolHandler } from './ui/SimulateUIInputToolHandler.js';
|
|
167
|
+
import { InputSystemHandler } from './input/InputSystemHandler.js';
|
|
168
|
+
import { KeyboardSimulationHandler } from './input/KeyboardSimulationHandler.js';
|
|
169
|
+
import { MouseSimulationHandler } from './input/MouseSimulationHandler.js';
|
|
170
|
+
import { GamepadSimulationHandler } from './input/GamepadSimulationHandler.js';
|
|
171
|
+
import { TouchSimulationHandler } from './input/TouchSimulationHandler.js';
|
|
172
|
+
import { CreateActionMapToolHandler } from './input/CreateActionMapToolHandler.js';
|
|
173
|
+
import { RemoveActionMapToolHandler } from './input/RemoveActionMapToolHandler.js';
|
|
174
|
+
import { AddInputActionToolHandler } from './input/AddInputActionToolHandler.js';
|
|
175
|
+
import { RemoveInputActionToolHandler } from './input/RemoveInputActionToolHandler.js';
|
|
176
|
+
import { AddInputBindingToolHandler } from './input/AddInputBindingToolHandler.js';
|
|
177
|
+
import { RemoveInputBindingToolHandler } from './input/RemoveInputBindingToolHandler.js';
|
|
178
|
+
import { RemoveAllBindingsToolHandler } from './input/RemoveAllBindingsToolHandler.js';
|
|
179
|
+
import { CreateCompositeBindingToolHandler } from './input/CreateCompositeBindingToolHandler.js';
|
|
180
|
+
import { ManageControlSchemesToolHandler } from './input/ManageControlSchemesToolHandler.js';
|
|
181
|
+
import { CreatePrefabToolHandler } from './asset/CreatePrefabToolHandler.js';
|
|
182
|
+
import { ModifyPrefabToolHandler } from './asset/ModifyPrefabToolHandler.js';
|
|
183
|
+
import { InstantiatePrefabToolHandler } from './asset/InstantiatePrefabToolHandler.js';
|
|
184
|
+
import { CreateMaterialToolHandler } from './asset/CreateMaterialToolHandler.js';
|
|
185
|
+
import { ModifyMaterialToolHandler } from './asset/ModifyMaterialToolHandler.js';
|
|
186
|
+
import { OpenPrefabToolHandler } from './asset/OpenPrefabToolHandler.js';
|
|
187
|
+
import { ExitPrefabModeToolHandler } from './asset/ExitPrefabModeToolHandler.js';
|
|
188
|
+
import { SavePrefabToolHandler } from './asset/SavePrefabToolHandler.js';
|
|
189
|
+
import { AssetImportSettingsToolHandler } from './asset/AssetImportSettingsToolHandler.js';
|
|
190
|
+
import { AssetDatabaseToolHandler } from './asset/AssetDatabaseToolHandler.js';
|
|
191
|
+
import { AssetDependencyToolHandler } from './asset/AssetDependencyToolHandler.js';
|
|
192
|
+
import { ExecuteMenuItemToolHandler } from './menu/ExecuteMenuItemToolHandler.js';
|
|
193
|
+
import { ClearConsoleToolHandler } from './console/ClearConsoleToolHandler.js';
|
|
194
|
+
import { ReadConsoleToolHandler } from './console/ReadConsoleToolHandler.js';
|
|
195
|
+
import { CaptureScreenshotToolHandler } from './screenshot/CaptureScreenshotToolHandler.js';
|
|
196
|
+
import { AnalyzeScreenshotToolHandler } from './screenshot/AnalyzeScreenshotToolHandler.js';
|
|
197
|
+
import { CaptureVideoStartToolHandler } from './video/CaptureVideoStartToolHandler.js';
|
|
198
|
+
import { CaptureVideoStopToolHandler } from './video/CaptureVideoStopToolHandler.js';
|
|
199
|
+
import { CaptureVideoStatusToolHandler } from './video/CaptureVideoStatusToolHandler.js';
|
|
200
|
+
import { CaptureVideoForToolHandler } from './video/CaptureVideoForToolHandler.js';
|
|
201
|
+
import { AddComponentToolHandler } from './component/AddComponentToolHandler.js';
|
|
202
|
+
import { RemoveComponentToolHandler } from './component/RemoveComponentToolHandler.js';
|
|
203
|
+
import { ModifyComponentToolHandler } from './component/ModifyComponentToolHandler.js';
|
|
204
|
+
import { ListComponentsToolHandler } from './component/ListComponentsToolHandler.js';
|
|
205
|
+
import { GetComponentTypesToolHandler } from './component/GetComponentTypesToolHandler.js';
|
|
206
|
+
import { GetCompilationStateToolHandler } from './compilation/GetCompilationStateToolHandler.js';
|
|
207
|
+
import { TagManagementToolHandler } from './editor/TagManagementToolHandler.js';
|
|
208
|
+
import { LayerManagementToolHandler } from './editor/LayerManagementToolHandler.js';
|
|
209
|
+
import { SelectionToolHandler } from './editor/SelectionToolHandler.js';
|
|
210
|
+
import { WindowManagementToolHandler } from './editor/WindowManagementToolHandler.js';
|
|
211
|
+
import { ToolManagementToolHandler } from './editor/ToolManagementToolHandler.js';
|
|
212
|
+
import { GetProjectSettingsToolHandler } from './settings/GetProjectSettingsToolHandler.js';
|
|
213
|
+
import { UpdateProjectSettingsToolHandler } from './settings/UpdateProjectSettingsToolHandler.js';
|
|
214
|
+
import PackageManagerToolHandler from './package/PackageManagerToolHandler.js';
|
|
215
|
+
import RegistryConfigToolHandler from './package/RegistryConfigToolHandler.js';
|
|
216
|
+
import { ScriptPackagesListToolHandler } from './script/ScriptPackagesListToolHandler.js';
|
|
217
|
+
import { ScriptReadToolHandler } from './script/ScriptReadToolHandler.js';
|
|
218
|
+
import { ScriptSearchToolHandler } from './script/ScriptSearchToolHandler.js';
|
|
219
|
+
import { ScriptEditStructuredToolHandler } from './script/ScriptEditStructuredToolHandler.js';
|
|
220
|
+
import { ScriptSymbolsGetToolHandler } from './script/ScriptSymbolsGetToolHandler.js';
|
|
221
|
+
import { ScriptSymbolFindToolHandler } from './script/ScriptSymbolFindToolHandler.js';
|
|
222
|
+
import { ScriptRefsFindToolHandler } from './script/ScriptRefsFindToolHandler.js';
|
|
223
|
+
import { ScriptIndexStatusToolHandler } from './script/ScriptIndexStatusToolHandler.js';
|
|
224
|
+
import { ScriptRefactorRenameToolHandler } from './script/ScriptRefactorRenameToolHandler.js';
|
|
225
|
+
import { ScriptCreateClassFileToolHandler } from './script/ScriptCreateClassFileToolHandler.js';
|
|
226
|
+
import { ScriptRemoveSymbolToolHandler } from './script/ScriptRemoveSymbolToolHandler.js';
|
|
227
|
+
import { BuildCodeIndexToolHandler } from './script/BuildCodeIndexToolHandler.js';
|
|
228
|
+
// Roslyn (external CLI) tool handlers removed(内部ユーティリティのみ存続)
|
|
229
|
+
|
|
230
|
+
// Handler registry - single source of truth
|
|
231
|
+
const HANDLER_CLASSES = [
|
|
232
|
+
// System handlers
|
|
233
|
+
PingToolHandler,
|
|
234
|
+
RefreshAssetsToolHandler,
|
|
235
|
+
GetCommandStatsToolHandler,
|
|
236
|
+
|
|
237
|
+
// GameObject handlers
|
|
238
|
+
CreateGameObjectToolHandler,
|
|
239
|
+
FindGameObjectToolHandler,
|
|
240
|
+
ModifyGameObjectToolHandler,
|
|
241
|
+
DeleteGameObjectToolHandler,
|
|
242
|
+
GetHierarchyToolHandler,
|
|
243
|
+
|
|
244
|
+
// Scene handlers
|
|
245
|
+
CreateSceneToolHandler,
|
|
246
|
+
LoadSceneToolHandler,
|
|
247
|
+
SaveSceneToolHandler,
|
|
248
|
+
ListScenesToolHandler,
|
|
249
|
+
GetSceneInfoToolHandler,
|
|
250
|
+
|
|
251
|
+
// Analysis handlers
|
|
252
|
+
GetGameObjectDetailsToolHandler,
|
|
253
|
+
AnalyzeSceneContentsToolHandler,
|
|
254
|
+
GetComponentValuesToolHandler,
|
|
255
|
+
FindByComponentToolHandler,
|
|
256
|
+
GetObjectReferencesToolHandler,
|
|
257
|
+
GetAnimatorStateToolHandler,
|
|
258
|
+
GetAnimatorRuntimeInfoToolHandler,
|
|
259
|
+
GetInputActionsStateToolHandler,
|
|
260
|
+
AnalyzeInputActionsAssetToolHandler,
|
|
261
|
+
|
|
262
|
+
// PlayMode handlers
|
|
263
|
+
PlayToolHandler,
|
|
264
|
+
PauseToolHandler,
|
|
265
|
+
StopToolHandler,
|
|
266
|
+
GetEditorStateToolHandler,
|
|
267
|
+
WaitForEditorStateToolHandler,
|
|
268
|
+
|
|
269
|
+
// UI handlers
|
|
270
|
+
FindUIElementsToolHandler,
|
|
271
|
+
ClickUIElementToolHandler,
|
|
272
|
+
GetUIElementStateToolHandler,
|
|
273
|
+
SetUIElementValueToolHandler,
|
|
274
|
+
SimulateUIInputToolHandler,
|
|
275
|
+
|
|
276
|
+
// Input System handlers
|
|
277
|
+
InputSystemHandler,
|
|
278
|
+
KeyboardSimulationHandler,
|
|
279
|
+
MouseSimulationHandler,
|
|
280
|
+
GamepadSimulationHandler,
|
|
281
|
+
TouchSimulationHandler,
|
|
282
|
+
CreateActionMapToolHandler,
|
|
283
|
+
RemoveActionMapToolHandler,
|
|
284
|
+
AddInputActionToolHandler,
|
|
285
|
+
RemoveInputActionToolHandler,
|
|
286
|
+
AddInputBindingToolHandler,
|
|
287
|
+
RemoveInputBindingToolHandler,
|
|
288
|
+
RemoveAllBindingsToolHandler,
|
|
289
|
+
CreateCompositeBindingToolHandler,
|
|
290
|
+
ManageControlSchemesToolHandler,
|
|
291
|
+
|
|
292
|
+
// Asset handlers
|
|
293
|
+
CreatePrefabToolHandler,
|
|
294
|
+
ModifyPrefabToolHandler,
|
|
295
|
+
InstantiatePrefabToolHandler,
|
|
296
|
+
CreateMaterialToolHandler,
|
|
297
|
+
ModifyMaterialToolHandler,
|
|
298
|
+
OpenPrefabToolHandler,
|
|
299
|
+
ExitPrefabModeToolHandler,
|
|
300
|
+
SavePrefabToolHandler,
|
|
301
|
+
AssetImportSettingsToolHandler,
|
|
302
|
+
AssetDatabaseToolHandler,
|
|
303
|
+
AssetDependencyToolHandler,
|
|
304
|
+
|
|
305
|
+
// Menu handlers
|
|
306
|
+
ExecuteMenuItemToolHandler,
|
|
307
|
+
|
|
308
|
+
// Console handlers
|
|
309
|
+
ClearConsoleToolHandler,
|
|
310
|
+
ReadConsoleToolHandler,
|
|
311
|
+
|
|
312
|
+
// Screenshot handlers
|
|
313
|
+
CaptureScreenshotToolHandler,
|
|
314
|
+
AnalyzeScreenshotToolHandler,
|
|
315
|
+
// Video handlers
|
|
316
|
+
CaptureVideoStartToolHandler,
|
|
317
|
+
CaptureVideoStopToolHandler,
|
|
318
|
+
CaptureVideoStatusToolHandler,
|
|
319
|
+
CaptureVideoForToolHandler,
|
|
320
|
+
// Script handlers
|
|
321
|
+
ScriptPackagesListToolHandler,
|
|
322
|
+
ScriptReadToolHandler,
|
|
323
|
+
ScriptSearchToolHandler,
|
|
324
|
+
ScriptEditStructuredToolHandler,
|
|
325
|
+
ScriptRefsFindToolHandler,
|
|
326
|
+
ScriptSymbolFindToolHandler,
|
|
327
|
+
ScriptSymbolsGetToolHandler,
|
|
328
|
+
ScriptIndexStatusToolHandler,
|
|
329
|
+
ScriptRefactorRenameToolHandler,
|
|
330
|
+
ScriptCreateClassFileToolHandler,
|
|
331
|
+
ScriptRemoveSymbolToolHandler,
|
|
332
|
+
BuildCodeIndexToolHandler,
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
// Component handlers
|
|
336
|
+
AddComponentToolHandler,
|
|
337
|
+
RemoveComponentToolHandler,
|
|
338
|
+
ModifyComponentToolHandler,
|
|
339
|
+
ListComponentsToolHandler,
|
|
340
|
+
GetComponentTypesToolHandler,
|
|
341
|
+
|
|
342
|
+
// Compilation handlers
|
|
343
|
+
GetCompilationStateToolHandler,
|
|
344
|
+
|
|
345
|
+
// Editor control handlers
|
|
346
|
+
TagManagementToolHandler,
|
|
347
|
+
LayerManagementToolHandler,
|
|
348
|
+
SelectionToolHandler,
|
|
349
|
+
WindowManagementToolHandler,
|
|
350
|
+
ToolManagementToolHandler,
|
|
351
|
+
|
|
352
|
+
// Settings handlers
|
|
353
|
+
GetProjectSettingsToolHandler,
|
|
354
|
+
UpdateProjectSettingsToolHandler,
|
|
355
|
+
|
|
356
|
+
// Package management handlers
|
|
357
|
+
PackageManagerToolHandler,
|
|
358
|
+
RegistryConfigToolHandler
|
|
359
|
+
];
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Creates and returns all tool handlers
|
|
363
|
+
* @param {UnityConnection} unityConnection - Connection to Unity
|
|
364
|
+
* @returns {Map<string, BaseToolHandler>} Map of tool name to handler
|
|
365
|
+
*/
|
|
366
|
+
export function createHandlers(unityConnection) {
|
|
367
|
+
const handlers = new Map();
|
|
368
|
+
const failedHandlers = [];
|
|
369
|
+
|
|
370
|
+
// Instantiate all handlers from the registry
|
|
371
|
+
for (const HandlerClass of HANDLER_CLASSES) {
|
|
372
|
+
try {
|
|
373
|
+
const handler = new HandlerClass(unityConnection);
|
|
374
|
+
handlers.set(handler.name, handler);
|
|
375
|
+
} catch (error) {
|
|
376
|
+
failedHandlers.push(HandlerClass.name);
|
|
377
|
+
console.error(`[MCP] Failed to create handler ${HandlerClass.name}:`, error.message);
|
|
378
|
+
// Continue with other handlers instead of throwing
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
if (failedHandlers.length > 0) {
|
|
383
|
+
console.error(`[MCP] Failed to initialize ${failedHandlers.length} handlers: ${failedHandlers.join(', ')}`);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
console.error(`[MCP] Successfully initialized ${handlers.size}/${HANDLER_CLASSES.length} handlers`);
|
|
387
|
+
|
|
388
|
+
return handlers;
|
|
389
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
import {
|
|
3
|
+
addInputActionToolDefinition,
|
|
4
|
+
addInputActionHandler
|
|
5
|
+
} from '../../tools/input/inputActionsEditor.js';
|
|
6
|
+
|
|
7
|
+
export class AddInputActionToolHandler extends BaseToolHandler {
|
|
8
|
+
constructor(unityConnection) {
|
|
9
|
+
super(
|
|
10
|
+
addInputActionToolDefinition.name,
|
|
11
|
+
addInputActionToolDefinition.description,
|
|
12
|
+
addInputActionToolDefinition.inputSchema
|
|
13
|
+
);
|
|
14
|
+
this.unityConnection = unityConnection;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async execute(args) {
|
|
18
|
+
return addInputActionHandler(this.unityConnection, args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
import {
|
|
3
|
+
addInputBindingToolDefinition,
|
|
4
|
+
addInputBindingHandler
|
|
5
|
+
} from '../../tools/input/inputActionsEditor.js';
|
|
6
|
+
|
|
7
|
+
export class AddInputBindingToolHandler extends BaseToolHandler {
|
|
8
|
+
constructor(unityConnection) {
|
|
9
|
+
super(
|
|
10
|
+
addInputBindingToolDefinition.name,
|
|
11
|
+
addInputBindingToolDefinition.description,
|
|
12
|
+
addInputBindingToolDefinition.inputSchema
|
|
13
|
+
);
|
|
14
|
+
this.unityConnection = unityConnection;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async execute(args) {
|
|
18
|
+
return addInputBindingHandler(this.unityConnection, args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
import {
|
|
3
|
+
createActionMapToolDefinition,
|
|
4
|
+
createActionMapHandler
|
|
5
|
+
} from '../../tools/input/inputActionsEditor.js';
|
|
6
|
+
|
|
7
|
+
export class CreateActionMapToolHandler extends BaseToolHandler {
|
|
8
|
+
constructor(unityConnection) {
|
|
9
|
+
super(
|
|
10
|
+
createActionMapToolDefinition.name,
|
|
11
|
+
createActionMapToolDefinition.description,
|
|
12
|
+
createActionMapToolDefinition.inputSchema
|
|
13
|
+
);
|
|
14
|
+
this.unityConnection = unityConnection;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async execute(args) {
|
|
18
|
+
return createActionMapHandler(this.unityConnection, args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
import {
|
|
3
|
+
createCompositeBindingToolDefinition,
|
|
4
|
+
createCompositeBindingHandler
|
|
5
|
+
} from '../../tools/input/inputActionsEditor.js';
|
|
6
|
+
|
|
7
|
+
export class CreateCompositeBindingToolHandler extends BaseToolHandler {
|
|
8
|
+
constructor(unityConnection) {
|
|
9
|
+
super(
|
|
10
|
+
createCompositeBindingToolDefinition.name,
|
|
11
|
+
createCompositeBindingToolDefinition.description,
|
|
12
|
+
createCompositeBindingToolDefinition.inputSchema
|
|
13
|
+
);
|
|
14
|
+
this.unityConnection = unityConnection;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async execute(args) {
|
|
18
|
+
return createCompositeBindingHandler(this.unityConnection, args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles gamepad input simulation
|
|
5
|
+
*/
|
|
6
|
+
export class GamepadSimulationHandler extends BaseToolHandler {
|
|
7
|
+
constructor(unityConnection) {
|
|
8
|
+
super(
|
|
9
|
+
'simulate_gamepad',
|
|
10
|
+
'Simulate gamepad input (buttons/sticks/triggers/dpad) with value ranges.',
|
|
11
|
+
{
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
action: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: ['button', 'stick', 'trigger', 'dpad'],
|
|
17
|
+
description: 'The gamepad action to perform'
|
|
18
|
+
},
|
|
19
|
+
button: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'Button name (a/cross, b/circle, x/square, y/triangle, start, select, etc.)'
|
|
22
|
+
},
|
|
23
|
+
buttonAction: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['press', 'release'],
|
|
26
|
+
|
|
27
|
+
description: 'Button action (press or release)'
|
|
28
|
+
},
|
|
29
|
+
stick: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
enum: ['left', 'right'],
|
|
32
|
+
|
|
33
|
+
description: 'Which analog stick to control'
|
|
34
|
+
},
|
|
35
|
+
x: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
minimum: -1,
|
|
38
|
+
maximum: 1,
|
|
39
|
+
description: 'Horizontal axis value for stick (-1 to 1)'
|
|
40
|
+
},
|
|
41
|
+
y: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
minimum: -1,
|
|
44
|
+
maximum: 1,
|
|
45
|
+
description: 'Vertical axis value for stick (-1 to 1)'
|
|
46
|
+
},
|
|
47
|
+
trigger: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
enum: ['left', 'right'],
|
|
50
|
+
|
|
51
|
+
description: 'Which trigger to control'
|
|
52
|
+
},
|
|
53
|
+
value: {
|
|
54
|
+
type: 'number',
|
|
55
|
+
minimum: 0,
|
|
56
|
+
maximum: 1,
|
|
57
|
+
description: 'Trigger pressure value (0 to 1)'
|
|
58
|
+
},
|
|
59
|
+
direction: {
|
|
60
|
+
type: 'string',
|
|
61
|
+
enum: ['up', 'down', 'left', 'right', 'none'],
|
|
62
|
+
description: 'D-pad direction'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
required: ['action']
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
this.unityConnection = unityConnection;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
validate(params) {
|
|
72
|
+
const { action, button, x, y, value, direction } = params;
|
|
73
|
+
|
|
74
|
+
if (!action) {
|
|
75
|
+
throw new Error('action is required');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
switch (action) {
|
|
79
|
+
case 'button':
|
|
80
|
+
if (!button) {
|
|
81
|
+
throw new Error('button is required for button action');
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case 'stick':
|
|
85
|
+
if (x === undefined || y === undefined) {
|
|
86
|
+
throw new Error('x and y values are required for stick action');
|
|
87
|
+
}
|
|
88
|
+
if (x < -1 || x > 1 || y < -1 || y > 1) {
|
|
89
|
+
throw new Error('Stick values must be between -1 and 1');
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'trigger':
|
|
93
|
+
if (value === undefined) {
|
|
94
|
+
throw new Error('value is required for trigger action');
|
|
95
|
+
}
|
|
96
|
+
if (value < 0 || value > 1) {
|
|
97
|
+
throw new Error('Trigger value must be between 0 and 1');
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
case 'dpad':
|
|
101
|
+
if (!direction) {
|
|
102
|
+
throw new Error('direction is required for dpad action');
|
|
103
|
+
}
|
|
104
|
+
break; }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async execute(params) {
|
|
108
|
+
// Ensure connected
|
|
109
|
+
if (!this.unityConnection.isConnected()) {
|
|
110
|
+
await this.unityConnection.connect();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const result = await this.unityConnection.sendCommand('simulate_gamepad_input', params);
|
|
114
|
+
return result;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BaseToolHandler } from '../base/BaseToolHandler.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Handles Input System operations
|
|
5
|
+
*/
|
|
6
|
+
export class InputSystemHandler extends BaseToolHandler {
|
|
7
|
+
constructor(unityConnection) {
|
|
8
|
+
super(
|
|
9
|
+
'input_system',
|
|
10
|
+
'Main handler for Input System operations',
|
|
11
|
+
{
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
operation: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
enum: ['keyboard', 'mouse', 'gamepad', 'touch', 'sequence', 'get_state'],
|
|
17
|
+
description: 'The input operation to perform'
|
|
18
|
+
},
|
|
19
|
+
parameters: {
|
|
20
|
+
type: 'object',
|
|
21
|
+
description: 'Parameters for the specific operation'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
required: ['operation']
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
this.unityConnection = unityConnection;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
validate(params) {
|
|
31
|
+
const { operation, parameters } = params;
|
|
32
|
+
|
|
33
|
+
if (!operation) {
|
|
34
|
+
throw new Error('operation is required');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const validOperations = ['keyboard', 'mouse', 'gamepad', 'touch', 'sequence', 'get_state'];
|
|
38
|
+
if (!validOperations.includes(operation)) {
|
|
39
|
+
throw new Error(`Invalid operation: ${operation}. Must be one of: ${validOperations.join(', ')}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Operation-specific validation
|
|
43
|
+
if (operation !== 'get_state' && !parameters) {
|
|
44
|
+
throw new Error(`parameters are required for operation: ${operation}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async execute(params) {
|
|
49
|
+
const { operation, parameters = {} } = params;
|
|
50
|
+
|
|
51
|
+
// Ensure connected
|
|
52
|
+
if (!this.unityConnection.isConnected()) {
|
|
53
|
+
await this.unityConnection.connect();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
let command;
|
|
57
|
+
switch (operation) {
|
|
58
|
+
case 'keyboard':
|
|
59
|
+
command = 'simulate_keyboard_input';
|
|
60
|
+
break;
|
|
61
|
+
case 'mouse':
|
|
62
|
+
command = 'simulate_mouse_input';
|
|
63
|
+
break;
|
|
64
|
+
case 'gamepad':
|
|
65
|
+
command = 'simulate_gamepad_input';
|
|
66
|
+
break;
|
|
67
|
+
case 'touch':
|
|
68
|
+
command = 'simulate_touch_input';
|
|
69
|
+
break;
|
|
70
|
+
case 'sequence':
|
|
71
|
+
command = 'create_input_sequence';
|
|
72
|
+
break;
|
|
73
|
+
case 'get_state':
|
|
74
|
+
command = 'get_current_input_state';
|
|
75
|
+
break; }
|
|
76
|
+
|
|
77
|
+
const result = await this.unityConnection.sendCommand(command, parameters);
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
}
|