@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.
- package/README.md +21 -0
- package/bin/unity-mcp-server +1 -1
- package/package.json +1 -1
- package/src/core/codeIndex.js +64 -15
- package/src/core/server.js +3 -34
- package/src/handlers/analysis/AnalyzeSceneContentsToolHandler.js +27 -24
- package/src/handlers/analysis/FindByComponentToolHandler.js +4 -1
- package/src/handlers/analysis/GetAnimatorStateToolHandler.js +5 -5
- package/src/handlers/analysis/GetComponentValuesToolHandler.js +4 -1
- package/src/handlers/analysis/GetGameObjectDetailsToolHandler.js +27 -24
- package/src/handlers/analysis/GetInputActionsStateToolHandler.js +5 -5
- package/src/handlers/analysis/GetObjectReferencesToolHandler.js +4 -1
- package/src/handlers/asset/AssetDatabaseManageToolHandler.js +24 -6
- package/src/handlers/asset/AssetDependencyAnalyzeToolHandler.js +21 -11
- package/src/handlers/asset/AssetImportSettingsManageToolHandler.js +7 -7
- package/src/handlers/asset/AssetMaterialCreateToolHandler.js +78 -81
- package/src/handlers/asset/AssetMaterialModifyToolHandler.js +57 -61
- package/src/handlers/asset/AssetPrefabCreateToolHandler.js +61 -64
- package/src/handlers/asset/AssetPrefabExitModeToolHandler.js +9 -13
- package/src/handlers/asset/AssetPrefabInstantiateToolHandler.js +110 -116
- package/src/handlers/asset/AssetPrefabModifyToolHandler.js +58 -58
- package/src/handlers/asset/AssetPrefabOpenToolHandler.js +7 -5
- package/src/handlers/asset/AssetPrefabSaveToolHandler.js +13 -6
- package/src/handlers/compilation/CompilationGetStateToolHandler.js +4 -3
- package/src/handlers/component/ComponentAddToolHandler.js +2 -2
- package/src/handlers/component/ComponentGetTypesToolHandler.js +17 -21
- package/src/handlers/component/ComponentListToolHandler.js +5 -3
- package/src/handlers/component/ComponentModifyToolHandler.js +3 -3
- package/src/handlers/component/ComponentRemoveToolHandler.js +2 -2
- package/src/handlers/console/ConsoleClearToolHandler.js +36 -46
- package/src/handlers/editor/EditorLayersManageToolHandler.js +7 -6
- package/src/handlers/editor/EditorTagsManageToolHandler.js +20 -11
- package/src/handlers/editor/EditorToolsManageToolHandler.js +2 -2
- package/src/handlers/editor/EditorWindowsManageToolHandler.js +6 -5
- package/src/handlers/gameobject/GameObjectCreateToolHandler.js +62 -66
- package/src/handlers/gameobject/GameObjectDeleteToolHandler.js +9 -9
- package/src/handlers/gameobject/GameObjectFindToolHandler.js +13 -11
- package/src/handlers/gameobject/GameObjectGetHierarchyToolHandler.js +22 -16
- package/src/handlers/input/InputActionAddToolHandler.js +2 -2
- package/src/handlers/input/InputActionMapCreateToolHandler.js +2 -2
- package/src/handlers/input/InputActionMapRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputActionRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputBindingAddToolHandler.js +2 -2
- package/src/handlers/input/InputBindingCompositeCreateToolHandler.js +2 -2
- package/src/handlers/input/InputBindingRemoveAllToolHandler.js +2 -2
- package/src/handlers/input/InputBindingRemoveToolHandler.js +2 -2
- package/src/handlers/input/InputControlSchemesManageToolHandler.js +2 -2
- package/src/handlers/package/PackageManagerToolHandler.js +41 -44
- package/src/handlers/package/RegistryConfigToolHandler.js +28 -7
- package/src/handlers/playmode/PlaymodeGetStateToolHandler.js +12 -16
- package/src/handlers/playmode/PlaymodePauseToolHandler.js +8 -12
- package/src/handlers/playmode/PlaymodeWaitForStateToolHandler.js +6 -3
- package/src/handlers/scene/GetSceneInfoToolHandler.js +11 -11
- package/src/handlers/scene/SceneCreateToolHandler.js +28 -31
- package/src/handlers/scene/SceneListToolHandler.js +21 -24
- package/src/handlers/scene/SceneLoadToolHandler.js +27 -29
- package/src/handlers/scene/SceneSaveToolHandler.js +19 -22
- package/src/handlers/screenshot/ScreenshotCaptureToolHandler.js +88 -66
- package/src/handlers/script/CodeIndexStatusToolHandler.js +4 -3
- package/src/handlers/script/CodeIndexUpdateToolHandler.js +24 -14
- package/src/handlers/script/ScriptCreateClassToolHandler.js +44 -9
- package/src/handlers/script/ScriptPackagesListToolHandler.js +91 -91
- package/src/handlers/script/ScriptRefactorRenameToolHandler.js +80 -71
- package/src/handlers/script/ScriptRemoveSymbolToolHandler.js +21 -7
- package/src/handlers/script/ScriptSearchToolHandler.js +299 -266
- package/src/handlers/script/ScriptSymbolsGetToolHandler.js +88 -79
- package/src/handlers/settings/SettingsGetToolHandler.js +28 -13
- package/src/handlers/settings/SettingsUpdateToolHandler.js +20 -6
- package/src/handlers/ui/UIClickElementToolHandler.js +87 -96
- package/src/handlers/ui/UIFindElementsToolHandler.js +45 -55
- package/src/handlers/ui/UIGetElementStateToolHandler.js +35 -43
- package/src/handlers/ui/UISetElementValueToolHandler.js +42 -49
- package/src/handlers/ui/UISimulateInputToolHandler.js +134 -136
- package/src/handlers/video/VideoCaptureForToolHandler.js +24 -7
- package/src/lsp/LspRpcClient.js +24 -12
- package/src/tools/analysis/analyzeSceneContents.js +85 -85
- package/src/tools/analysis/findByComponent.js +73 -73
- package/src/tools/analysis/getAnimatorState.js +287 -287
- package/src/tools/analysis/getComponentValues.js +161 -161
- package/src/tools/analysis/getGameObjectDetails.js +138 -138
- package/src/tools/analysis/getInputActionsState.js +291 -291
- package/src/tools/analysis/getObjectReferences.js +72 -72
- package/src/tools/input/inputActionsEditor.js +522 -474
- package/src/tools/scene/createScene.js +98 -97
- package/src/tools/scene/getSceneInfo.js +82 -81
- package/src/tools/scene/listScenes.js +70 -69
- package/src/tools/scene/loadScene.js +108 -106
- package/src/tools/scene/saveScene.js +78 -77
- package/src/tools/system/ping.js +9 -12
- package/src/utils/validators.js +2 -2
|
@@ -2,555 +2,603 @@
|
|
|
2
2
|
|
|
3
3
|
// Action Map Management
|
|
4
4
|
export const createActionMapToolDefinition = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
5
|
+
name: 'input_action_map_create',
|
|
6
|
+
description: 'Create a new Action Map in an Input Actions asset',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
assetPath: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'Path to the Input Actions asset file'
|
|
13
|
+
},
|
|
14
|
+
mapName: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Name for the new Action Map'
|
|
17
|
+
},
|
|
18
|
+
actions: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
description: 'Optional array of actions to add',
|
|
21
|
+
items: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
name: { type: 'string' },
|
|
25
|
+
type: { type: 'string', enum: ['Button', 'Value', 'PassThrough'] }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
required: ['assetPath', 'mapName']
|
|
31
|
+
}
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export const removeActionMapToolDefinition = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
name: 'input_action_map_remove',
|
|
36
|
+
description: 'Remove an Action Map from an Input Actions asset',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
assetPath: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Path to the Input Actions asset file'
|
|
43
|
+
},
|
|
44
|
+
mapName: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Name of the Action Map to remove'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
required: ['assetPath', 'mapName']
|
|
50
|
+
}
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
// Action Management
|
|
54
54
|
export const addInputActionToolDefinition = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
name: 'input_action_add',
|
|
56
|
+
description: 'Add a new Action to an Action Map',
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
assetPath: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Path to the Input Actions asset file'
|
|
63
|
+
},
|
|
64
|
+
mapName: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
description: 'Name of the Action Map'
|
|
67
|
+
},
|
|
68
|
+
actionName: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'Name for the new Action'
|
|
71
|
+
},
|
|
72
|
+
actionType: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
description: 'Type of the action',
|
|
75
|
+
enum: ['Button', 'Value', 'PassThrough'],
|
|
76
|
+
default: 'Button'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
required: ['assetPath', 'mapName', 'actionName']
|
|
80
|
+
}
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const removeInputActionToolDefinition = {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
84
|
+
name: 'input_action_remove',
|
|
85
|
+
description: 'Remove an Action from an Action Map',
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: {
|
|
89
|
+
assetPath: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'Path to the Input Actions asset file'
|
|
92
|
+
},
|
|
93
|
+
mapName: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
description: 'Name of the Action Map'
|
|
96
|
+
},
|
|
97
|
+
actionName: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
description: 'Name of the Action to remove'
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
required: ['assetPath', 'mapName', 'actionName']
|
|
103
|
+
}
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
// Binding Management
|
|
107
107
|
export const addInputBindingToolDefinition = {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
108
|
+
name: 'input_binding_add',
|
|
109
|
+
description: 'Add a new Binding to an Action',
|
|
110
|
+
inputSchema: {
|
|
111
|
+
type: 'object',
|
|
112
|
+
properties: {
|
|
113
|
+
assetPath: {
|
|
114
|
+
type: 'string',
|
|
115
|
+
description: 'Path to the Input Actions asset file'
|
|
116
|
+
},
|
|
117
|
+
mapName: {
|
|
118
|
+
type: 'string',
|
|
119
|
+
description: 'Name of the Action Map'
|
|
120
|
+
},
|
|
121
|
+
actionName: {
|
|
122
|
+
type: 'string',
|
|
123
|
+
description: 'Name of the Action'
|
|
124
|
+
},
|
|
125
|
+
path: {
|
|
126
|
+
type: 'string',
|
|
127
|
+
description: 'Binding path (e.g., "<Keyboard>/space", "<Gamepad>/buttonSouth")'
|
|
128
|
+
},
|
|
129
|
+
groups: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Control scheme groups (e.g., "Keyboard&Mouse")'
|
|
132
|
+
},
|
|
133
|
+
interactions: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
description: 'Interactions (e.g., "press", "hold")'
|
|
136
|
+
},
|
|
137
|
+
processors: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
description: 'Processors (e.g., "scale", "invert")'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
required: ['assetPath', 'mapName', 'actionName', 'path']
|
|
143
|
+
}
|
|
144
144
|
};
|
|
145
145
|
|
|
146
146
|
export const removeInputBindingToolDefinition = {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
147
|
+
name: 'input_binding_remove',
|
|
148
|
+
description: 'Remove a Binding from an Action',
|
|
149
|
+
inputSchema: {
|
|
150
|
+
type: 'object',
|
|
151
|
+
properties: {
|
|
152
|
+
assetPath: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
description: 'Path to the Input Actions asset file'
|
|
155
|
+
},
|
|
156
|
+
mapName: {
|
|
157
|
+
type: 'string',
|
|
158
|
+
description: 'Name of the Action Map'
|
|
159
|
+
},
|
|
160
|
+
actionName: {
|
|
161
|
+
type: 'string',
|
|
162
|
+
description: 'Name of the Action'
|
|
163
|
+
},
|
|
164
|
+
bindingIndex: {
|
|
165
|
+
type: 'number',
|
|
166
|
+
description: 'Index of the binding to remove'
|
|
167
|
+
},
|
|
168
|
+
bindingPath: {
|
|
169
|
+
type: 'string',
|
|
170
|
+
description: 'Path of the binding to remove (alternative to bindingIndex)'
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
required: ['assetPath', 'mapName', 'actionName']
|
|
174
|
+
}
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
export const removeAllBindingsToolDefinition = {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
178
|
+
name: 'input_binding_remove_all',
|
|
179
|
+
description: 'Remove all Bindings from an Action',
|
|
180
|
+
inputSchema: {
|
|
181
|
+
type: 'object',
|
|
182
|
+
properties: {
|
|
183
|
+
assetPath: {
|
|
184
|
+
type: 'string',
|
|
185
|
+
description: 'Path to the Input Actions asset file'
|
|
186
|
+
},
|
|
187
|
+
mapName: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: 'Name of the Action Map'
|
|
190
|
+
},
|
|
191
|
+
actionName: {
|
|
192
|
+
type: 'string',
|
|
193
|
+
description: 'Name of the Action'
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
required: ['assetPath', 'mapName', 'actionName']
|
|
197
|
+
}
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
export const createCompositeBindingToolDefinition = {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
201
|
+
name: 'input_binding_composite_create',
|
|
202
|
+
description: 'Create a composite binding (e.g., 2D Vector for WASD movement)',
|
|
203
|
+
inputSchema: {
|
|
204
|
+
type: 'object',
|
|
205
|
+
properties: {
|
|
206
|
+
assetPath: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
description: 'Path to the Input Actions asset file'
|
|
209
|
+
},
|
|
210
|
+
mapName: {
|
|
211
|
+
type: 'string',
|
|
212
|
+
description: 'Name of the Action Map'
|
|
213
|
+
},
|
|
214
|
+
actionName: {
|
|
215
|
+
type: 'string',
|
|
216
|
+
description: 'Name of the Action'
|
|
217
|
+
},
|
|
218
|
+
compositeType: {
|
|
219
|
+
type: 'string',
|
|
220
|
+
description: 'Type of composite',
|
|
221
|
+
enum: ['2DVector', '1DAxis'],
|
|
222
|
+
default: '2DVector'
|
|
223
|
+
},
|
|
224
|
+
name: {
|
|
225
|
+
type: 'string',
|
|
226
|
+
description: 'Name for the composite binding'
|
|
227
|
+
},
|
|
228
|
+
bindings: {
|
|
204
229
|
type: 'object',
|
|
230
|
+
description: 'Binding paths for composite parts',
|
|
205
231
|
properties: {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
enum: ['2DVector', '1DAxis'],
|
|
222
|
-
default: '2DVector'
|
|
223
|
-
},
|
|
224
|
-
name: {
|
|
225
|
-
type: 'string',
|
|
226
|
-
description: 'Name for the composite binding'
|
|
227
|
-
},
|
|
228
|
-
bindings: {
|
|
229
|
-
type: 'object',
|
|
230
|
-
description: 'Binding paths for composite parts',
|
|
231
|
-
properties: {
|
|
232
|
-
up: { type: 'string' },
|
|
233
|
-
down: { type: 'string' },
|
|
234
|
-
left: { type: 'string' },
|
|
235
|
-
right: { type: 'string' },
|
|
236
|
-
negative: { type: 'string' },
|
|
237
|
-
positive: { type: 'string' }
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
groups: {
|
|
241
|
-
type: 'string',
|
|
242
|
-
description: 'Control scheme groups'
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
required: ['assetPath', 'mapName', 'actionName', 'bindings']
|
|
246
|
-
}
|
|
232
|
+
up: { type: 'string' },
|
|
233
|
+
down: { type: 'string' },
|
|
234
|
+
left: { type: 'string' },
|
|
235
|
+
right: { type: 'string' },
|
|
236
|
+
negative: { type: 'string' },
|
|
237
|
+
positive: { type: 'string' }
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
groups: {
|
|
241
|
+
type: 'string',
|
|
242
|
+
description: 'Control scheme groups'
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
required: ['assetPath', 'mapName', 'actionName', 'bindings']
|
|
246
|
+
}
|
|
247
247
|
};
|
|
248
248
|
|
|
249
249
|
// Control Scheme Management
|
|
250
250
|
export const manageControlSchemesToolDefinition = {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
251
|
+
name: 'input_control_schemes_manage',
|
|
252
|
+
description: 'Manage Control Schemes in an Input Actions asset',
|
|
253
|
+
inputSchema: {
|
|
254
|
+
type: 'object',
|
|
255
|
+
properties: {
|
|
256
|
+
assetPath: {
|
|
257
|
+
type: 'string',
|
|
258
|
+
description: 'Path to the Input Actions asset file'
|
|
259
|
+
},
|
|
260
|
+
operation: {
|
|
261
|
+
type: 'string',
|
|
262
|
+
description: 'Operation to perform',
|
|
263
|
+
enum: ['add', 'remove', 'modify']
|
|
264
|
+
},
|
|
265
|
+
schemeName: {
|
|
266
|
+
type: 'string',
|
|
267
|
+
description: 'Name of the control scheme'
|
|
268
|
+
},
|
|
269
|
+
devices: {
|
|
270
|
+
type: 'array',
|
|
271
|
+
description: 'List of device types (e.g., ["Keyboard", "Mouse", "Gamepad"])',
|
|
272
|
+
items: { type: 'string' }
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
required: ['assetPath', 'operation']
|
|
276
|
+
}
|
|
277
277
|
};
|
|
278
278
|
|
|
279
279
|
// Helper function to format Unity response
|
|
280
280
|
function formatUnityResponse(result, successMessage) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
281
|
+
if (!result || typeof result === 'string') {
|
|
282
|
+
return {
|
|
283
|
+
content: [
|
|
284
|
+
{
|
|
285
|
+
type: 'text',
|
|
286
|
+
text: `Failed: Invalid response format`
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
isError: true
|
|
290
|
+
};
|
|
291
|
+
}
|
|
290
292
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
293
|
+
if (result.error) {
|
|
294
|
+
return {
|
|
295
|
+
content: [
|
|
296
|
+
{
|
|
297
|
+
type: 'text',
|
|
298
|
+
text: `Failed: ${result.error}`
|
|
299
|
+
}
|
|
300
|
+
],
|
|
301
|
+
isError: true
|
|
302
|
+
};
|
|
303
|
+
}
|
|
300
304
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
return {
|
|
311
|
-
content: [{
|
|
312
|
-
type: 'text',
|
|
313
|
-
text: text
|
|
314
|
-
}],
|
|
315
|
-
isError: false
|
|
316
|
-
};
|
|
317
|
-
}
|
|
305
|
+
if (result.success) {
|
|
306
|
+
let text = result.message || successMessage;
|
|
307
|
+
// Add any additional info from result
|
|
308
|
+
Object.keys(result).forEach(key => {
|
|
309
|
+
if (key !== 'success' && key !== 'message' && key !== 'error') {
|
|
310
|
+
text += `\n${key}: ${result[key]}`;
|
|
311
|
+
}
|
|
312
|
+
});
|
|
318
313
|
|
|
319
314
|
return {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
content: [
|
|
316
|
+
{
|
|
317
|
+
type: 'text',
|
|
318
|
+
text: text
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
isError: false
|
|
325
322
|
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return {
|
|
326
|
+
content: [
|
|
327
|
+
{
|
|
328
|
+
type: 'text',
|
|
329
|
+
text: 'Operation completed'
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
isError: false
|
|
333
|
+
};
|
|
326
334
|
}
|
|
327
335
|
|
|
328
336
|
// Handlers for Action Map Management
|
|
329
337
|
export async function createActionMapHandler(unityConnection, args) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const result = await unityConnection.sendCommand('input_action_map_create', args);
|
|
342
|
-
return formatUnityResponse(result, `Created Action Map: ${args.mapName}`);
|
|
343
|
-
} catch (error) {
|
|
344
|
-
return {
|
|
345
|
-
content: [{
|
|
346
|
-
type: 'text',
|
|
347
|
-
text: `Failed to create Action Map: ${error.message}`
|
|
348
|
-
}],
|
|
349
|
-
isError: true
|
|
350
|
-
};
|
|
338
|
+
try {
|
|
339
|
+
if (!unityConnection.isConnected()) {
|
|
340
|
+
return {
|
|
341
|
+
content: [
|
|
342
|
+
{
|
|
343
|
+
type: 'text',
|
|
344
|
+
text: 'Failed to create Action Map: Unity connection not available'
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
isError: true
|
|
348
|
+
};
|
|
351
349
|
}
|
|
352
|
-
}
|
|
353
350
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
isError: true
|
|
363
|
-
};
|
|
351
|
+
const result = await unityConnection.sendCommand('input_action_map_create', args);
|
|
352
|
+
return formatUnityResponse(result, `Created Action Map: ${args.mapName}`);
|
|
353
|
+
} catch (error) {
|
|
354
|
+
return {
|
|
355
|
+
content: [
|
|
356
|
+
{
|
|
357
|
+
type: 'text',
|
|
358
|
+
text: `Failed to create Action Map: ${error.message}`
|
|
364
359
|
}
|
|
360
|
+
],
|
|
361
|
+
isError: true
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
365
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
366
|
+
export async function removeActionMapHandler(unityConnection, args) {
|
|
367
|
+
try {
|
|
368
|
+
if (!unityConnection.isConnected()) {
|
|
369
|
+
return {
|
|
370
|
+
content: [
|
|
371
|
+
{
|
|
372
|
+
type: 'text',
|
|
373
|
+
text: 'Failed to remove Action Map: Unity connection not available'
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
isError: true
|
|
377
|
+
};
|
|
376
378
|
}
|
|
379
|
+
|
|
380
|
+
const result = await unityConnection.sendCommand('input_action_map_remove', args);
|
|
381
|
+
return formatUnityResponse(result, `Removed Action Map: ${args.mapName}`);
|
|
382
|
+
} catch (error) {
|
|
383
|
+
return {
|
|
384
|
+
content: [
|
|
385
|
+
{
|
|
386
|
+
type: 'text',
|
|
387
|
+
text: `Failed to remove Action Map: ${error.message}`
|
|
388
|
+
}
|
|
389
|
+
],
|
|
390
|
+
isError: true
|
|
391
|
+
};
|
|
392
|
+
}
|
|
377
393
|
}
|
|
378
394
|
|
|
379
395
|
// Handlers for Action Management
|
|
380
396
|
export async function addInputActionHandler(unityConnection, args) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const result = await unityConnection.sendCommand('input_action_add', args);
|
|
393
|
-
return formatUnityResponse(result, `Added Action: ${args.actionName}`);
|
|
394
|
-
} catch (error) {
|
|
395
|
-
return {
|
|
396
|
-
content: [{
|
|
397
|
-
type: 'text',
|
|
398
|
-
text: `Failed to add Input Action: ${error.message}`
|
|
399
|
-
}],
|
|
400
|
-
isError: true
|
|
401
|
-
};
|
|
397
|
+
try {
|
|
398
|
+
if (!unityConnection.isConnected()) {
|
|
399
|
+
return {
|
|
400
|
+
content: [
|
|
401
|
+
{
|
|
402
|
+
type: 'text',
|
|
403
|
+
text: 'Failed to add Input Action: Unity connection not available'
|
|
404
|
+
}
|
|
405
|
+
],
|
|
406
|
+
isError: true
|
|
407
|
+
};
|
|
402
408
|
}
|
|
403
|
-
}
|
|
404
409
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
isError: true
|
|
414
|
-
};
|
|
410
|
+
const result = await unityConnection.sendCommand('input_action_add', args);
|
|
411
|
+
return formatUnityResponse(result, `Added Action: ${args.actionName}`);
|
|
412
|
+
} catch (error) {
|
|
413
|
+
return {
|
|
414
|
+
content: [
|
|
415
|
+
{
|
|
416
|
+
type: 'text',
|
|
417
|
+
text: `Failed to add Input Action: ${error.message}`
|
|
415
418
|
}
|
|
419
|
+
],
|
|
420
|
+
isError: true
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
}
|
|
416
424
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
export async function removeInputActionHandler(unityConnection, args) {
|
|
426
|
+
try {
|
|
427
|
+
if (!unityConnection.isConnected()) {
|
|
428
|
+
return {
|
|
429
|
+
content: [
|
|
430
|
+
{
|
|
431
|
+
type: 'text',
|
|
432
|
+
text: 'Failed to remove Input Action: Unity connection not available'
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
isError: true
|
|
436
|
+
};
|
|
427
437
|
}
|
|
438
|
+
|
|
439
|
+
const result = await unityConnection.sendCommand('input_action_remove', args);
|
|
440
|
+
return formatUnityResponse(result, `Removed Action: ${args.actionName}`);
|
|
441
|
+
} catch (error) {
|
|
442
|
+
return {
|
|
443
|
+
content: [
|
|
444
|
+
{
|
|
445
|
+
type: 'text',
|
|
446
|
+
text: `Failed to remove Input Action: ${error.message}`
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
isError: true
|
|
450
|
+
};
|
|
451
|
+
}
|
|
428
452
|
}
|
|
429
453
|
|
|
430
454
|
// Handlers for Binding Management
|
|
431
455
|
export async function addInputBindingHandler(unityConnection, args) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
const result = await unityConnection.sendCommand('input_binding_add', args);
|
|
444
|
-
return formatUnityResponse(result, `Added Binding: ${args.path}`);
|
|
445
|
-
} catch (error) {
|
|
446
|
-
return {
|
|
447
|
-
content: [{
|
|
448
|
-
type: 'text',
|
|
449
|
-
text: `Failed to add Input Binding: ${error.message}`
|
|
450
|
-
}],
|
|
451
|
-
isError: true
|
|
452
|
-
};
|
|
456
|
+
try {
|
|
457
|
+
if (!unityConnection.isConnected()) {
|
|
458
|
+
return {
|
|
459
|
+
content: [
|
|
460
|
+
{
|
|
461
|
+
type: 'text',
|
|
462
|
+
text: 'Failed to add Input Binding: Unity connection not available'
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
isError: true
|
|
466
|
+
};
|
|
453
467
|
}
|
|
454
|
-
}
|
|
455
468
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
isError: true
|
|
465
|
-
};
|
|
469
|
+
const result = await unityConnection.sendCommand('input_binding_add', args);
|
|
470
|
+
return formatUnityResponse(result, `Added Binding: ${args.path}`);
|
|
471
|
+
} catch (error) {
|
|
472
|
+
return {
|
|
473
|
+
content: [
|
|
474
|
+
{
|
|
475
|
+
type: 'text',
|
|
476
|
+
text: `Failed to add Input Binding: ${error.message}`
|
|
466
477
|
}
|
|
478
|
+
],
|
|
479
|
+
isError: true
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
}
|
|
467
483
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
484
|
+
export async function removeInputBindingHandler(unityConnection, args) {
|
|
485
|
+
try {
|
|
486
|
+
if (!unityConnection.isConnected()) {
|
|
487
|
+
return {
|
|
488
|
+
content: [
|
|
489
|
+
{
|
|
490
|
+
type: 'text',
|
|
491
|
+
text: 'Failed to remove Input Binding: Unity connection not available'
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
isError: true
|
|
495
|
+
};
|
|
478
496
|
}
|
|
479
|
-
}
|
|
480
497
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
isError: true
|
|
490
|
-
};
|
|
498
|
+
const result = await unityConnection.sendCommand('input_binding_remove', args);
|
|
499
|
+
return formatUnityResponse(result, 'Removed Binding');
|
|
500
|
+
} catch (error) {
|
|
501
|
+
return {
|
|
502
|
+
content: [
|
|
503
|
+
{
|
|
504
|
+
type: 'text',
|
|
505
|
+
text: `Failed to remove Input Binding: ${error.message}`
|
|
491
506
|
}
|
|
507
|
+
],
|
|
508
|
+
isError: true
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
}
|
|
492
512
|
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
513
|
+
export async function removeAllBindingsHandler(unityConnection, args) {
|
|
514
|
+
try {
|
|
515
|
+
if (!unityConnection.isConnected()) {
|
|
516
|
+
return {
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: 'text',
|
|
520
|
+
text: 'Failed to remove all bindings: Unity connection not available'
|
|
521
|
+
}
|
|
522
|
+
],
|
|
523
|
+
isError: true
|
|
524
|
+
};
|
|
503
525
|
}
|
|
504
|
-
}
|
|
505
526
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
isError: true
|
|
515
|
-
};
|
|
527
|
+
const result = await unityConnection.sendCommand('input_binding_remove_all', args);
|
|
528
|
+
return formatUnityResponse(result, `Removed all bindings from ${args.actionName}`);
|
|
529
|
+
} catch (error) {
|
|
530
|
+
return {
|
|
531
|
+
content: [
|
|
532
|
+
{
|
|
533
|
+
type: 'text',
|
|
534
|
+
text: `Failed to remove all bindings: ${error.message}`
|
|
516
535
|
}
|
|
536
|
+
],
|
|
537
|
+
isError: true
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
}
|
|
517
541
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
542
|
+
export async function createCompositeBindingHandler(unityConnection, args) {
|
|
543
|
+
try {
|
|
544
|
+
if (!unityConnection.isConnected()) {
|
|
545
|
+
return {
|
|
546
|
+
content: [
|
|
547
|
+
{
|
|
548
|
+
type: 'text',
|
|
549
|
+
text: 'Failed to create composite binding: Unity connection not available'
|
|
550
|
+
}
|
|
551
|
+
],
|
|
552
|
+
isError: true
|
|
553
|
+
};
|
|
528
554
|
}
|
|
555
|
+
|
|
556
|
+
const result = await unityConnection.sendCommand('input_binding_composite_create', args);
|
|
557
|
+
return formatUnityResponse(
|
|
558
|
+
result,
|
|
559
|
+
`Created composite binding: ${args.name || args.compositeType}`
|
|
560
|
+
);
|
|
561
|
+
} catch (error) {
|
|
562
|
+
return {
|
|
563
|
+
content: [
|
|
564
|
+
{
|
|
565
|
+
type: 'text',
|
|
566
|
+
text: `Failed to create composite binding: ${error.message}`
|
|
567
|
+
}
|
|
568
|
+
],
|
|
569
|
+
isError: true
|
|
570
|
+
};
|
|
571
|
+
}
|
|
529
572
|
}
|
|
530
573
|
|
|
531
574
|
// Handler for Control Scheme Management
|
|
532
575
|
export async function manageControlSchemesHandler(unityConnection, args) {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
const result = await unityConnection.sendCommand('input_control_schemes_manage', args);
|
|
545
|
-
const operationText = args.operation === 'add' ? 'Added' : args.operation === 'remove' ? 'Removed' : 'Modified';
|
|
546
|
-
return formatUnityResponse(result, `${operationText} control scheme: ${args.schemeName}`);
|
|
547
|
-
} catch (error) {
|
|
548
|
-
return {
|
|
549
|
-
content: [{
|
|
550
|
-
type: 'text',
|
|
551
|
-
text: `Failed to manage control schemes: ${error.message}`
|
|
552
|
-
}],
|
|
553
|
-
isError: true
|
|
554
|
-
};
|
|
576
|
+
try {
|
|
577
|
+
if (!unityConnection.isConnected()) {
|
|
578
|
+
return {
|
|
579
|
+
content: [
|
|
580
|
+
{
|
|
581
|
+
type: 'text',
|
|
582
|
+
text: 'Failed to manage control schemes: Unity connection not available'
|
|
583
|
+
}
|
|
584
|
+
],
|
|
585
|
+
isError: true
|
|
586
|
+
};
|
|
555
587
|
}
|
|
556
|
-
|
|
588
|
+
|
|
589
|
+
const result = await unityConnection.sendCommand('input_control_schemes_manage', args);
|
|
590
|
+
const operationText =
|
|
591
|
+
args.operation === 'add' ? 'Added' : args.operation === 'remove' ? 'Removed' : 'Modified';
|
|
592
|
+
return formatUnityResponse(result, `${operationText} control scheme: ${args.schemeName}`);
|
|
593
|
+
} catch (error) {
|
|
594
|
+
return {
|
|
595
|
+
content: [
|
|
596
|
+
{
|
|
597
|
+
type: 'text',
|
|
598
|
+
text: `Failed to manage control schemes: ${error.message}`
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
isError: true
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}
|