@akiojin/unity-mcp-server 2.40.2 → 2.40.4
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 +4 -3
- package/src/core/codeIndex.js +143 -20
- package/src/core/indexWatcher.js +11 -0
- package/src/core/server.js +9 -34
- package/src/core/sqliteFallback.js +75 -0
- 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/CodeIndexBuildToolHandler.js +7 -0
- 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
|
@@ -1,329 +1,329 @@
|
|
|
1
1
|
// Tool definitions for Input Actions analysis
|
|
2
2
|
export const getInputActionsStateToolDefinition = {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
3
|
+
name: 'input_actions_state_get',
|
|
4
|
+
description: 'Get Input Actions state: maps, actions, bindings, devices, JSON structure.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
assetName: {
|
|
9
|
+
type: 'string',
|
|
10
|
+
description: 'Name of the Input Actions asset'
|
|
11
|
+
},
|
|
12
|
+
assetPath: {
|
|
13
|
+
type: 'string',
|
|
14
|
+
description: 'Path to the Input Actions asset file'
|
|
15
|
+
},
|
|
16
|
+
includeBindings: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
description: 'Include binding information. Default: true',
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
includeControlSchemes: {
|
|
22
|
+
type: 'boolean',
|
|
23
|
+
description: 'Include control schemes information. Default: true',
|
|
24
|
+
default: true
|
|
25
|
+
},
|
|
26
|
+
includeJsonStructure: {
|
|
27
|
+
type: 'boolean',
|
|
28
|
+
description: 'Include raw JSON structure. Default: false',
|
|
29
|
+
default: false
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
required: []
|
|
33
|
+
}
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
export const analyzeInputActionsAssetToolDefinition = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
37
|
+
name: 'input_actions_asset_analyze',
|
|
38
|
+
description: 'Analyze an Input Actions asset in detail (statistics + device usage).',
|
|
39
|
+
inputSchema: {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
assetPath: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'Path to the Input Actions asset file'
|
|
45
|
+
},
|
|
46
|
+
includeJsonStructure: {
|
|
47
|
+
type: 'boolean',
|
|
48
|
+
description: 'Include raw JSON structure. Default: true',
|
|
49
|
+
default: true
|
|
50
|
+
},
|
|
51
|
+
includeStatistics: {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
description: 'Include usage statistics. Default: true',
|
|
54
|
+
default: true
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
required: ['assetPath']
|
|
58
|
+
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// Handler for get_input_actions_state
|
|
62
62
|
export async function getInputActionsStateHandler(unityConnection, args) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
try {
|
|
64
|
+
// Check connection
|
|
65
|
+
if (!unityConnection.isConnected()) {
|
|
66
|
+
return {
|
|
67
|
+
content: [
|
|
68
|
+
{
|
|
69
|
+
type: 'text',
|
|
70
|
+
text: 'Failed to get Input Actions state: Unity connection not available'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
isError: true
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
// Send command to Unity
|
|
78
|
+
const result = await unityConnection.sendCommand('input_actions_state_get', args);
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
// Check for errors
|
|
81
|
+
if (!result || typeof result === 'string') {
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: 'text',
|
|
86
|
+
text: `Failed to get Input Actions state: Invalid response format`
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
isError: true
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
if (result.error) {
|
|
94
|
+
return {
|
|
95
|
+
content: [
|
|
96
|
+
{
|
|
97
|
+
type: 'text',
|
|
98
|
+
text: `Failed to get Input Actions state: ${result.error}`
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
isError: true
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
result.actionMaps.forEach(map => {
|
|
113
|
-
text += `\n\n### ${map.name}`;
|
|
114
|
-
text += `\n- ID: ${map.id}`;
|
|
115
|
-
|
|
116
|
-
if (map.actions && Array.isArray(map.actions)) {
|
|
117
|
-
text += `\n- Actions (${map.actions.length}):`;
|
|
118
|
-
map.actions.forEach(action => {
|
|
119
|
-
text += `\n • ${action.name} (${action.type})`;
|
|
120
|
-
if (action.expectedControlType) {
|
|
121
|
-
text += ` - Expected: ${action.expectedControlType}`;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (action.bindings && Array.isArray(action.bindings)) {
|
|
125
|
-
text += `\n Bindings (${action.bindings.length}):`;
|
|
126
|
-
action.bindings.forEach(binding => {
|
|
127
|
-
if (binding.isComposite) {
|
|
128
|
-
text += `\n - Composite: ${binding.name || 'Unnamed'}`;
|
|
129
|
-
} else if (binding.isPartOfComposite) {
|
|
130
|
-
text += `\n • ${binding.path}`;
|
|
131
|
-
} else {
|
|
132
|
-
text += `\n - ${binding.path}`;
|
|
133
|
-
}
|
|
134
|
-
if (binding.groups) {
|
|
135
|
-
text += ` [${binding.groups}]`;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
105
|
+
// Format the response
|
|
106
|
+
let text = `Input Actions Asset: ${result.assetName}`;
|
|
107
|
+
text += `\nPath: ${result.assetPath}`;
|
|
108
|
+
|
|
109
|
+
if (result.actionMaps && Array.isArray(result.actionMaps)) {
|
|
110
|
+
text += `\n\n## Action Maps (${result.actionMaps.length}):`;
|
|
143
111
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
112
|
+
result.actionMaps.forEach(map => {
|
|
113
|
+
text += `\n\n### ${map.name}`;
|
|
114
|
+
text += `\n- ID: ${map.id}`;
|
|
115
|
+
|
|
116
|
+
if (map.actions && Array.isArray(map.actions)) {
|
|
117
|
+
text += `\n- Actions (${map.actions.length}):`;
|
|
118
|
+
map.actions.forEach(action => {
|
|
119
|
+
text += `\n • ${action.name} (${action.type})`;
|
|
120
|
+
if (action.expectedControlType) {
|
|
121
|
+
text += ` - Expected: ${action.expectedControlType}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (action.bindings && Array.isArray(action.bindings)) {
|
|
125
|
+
text += `\n Bindings (${action.bindings.length}):`;
|
|
126
|
+
action.bindings.forEach(binding => {
|
|
127
|
+
if (binding.isComposite) {
|
|
128
|
+
text += `\n - Composite: ${binding.name || 'Unnamed'}`;
|
|
129
|
+
} else if (binding.isPartOfComposite) {
|
|
130
|
+
text += `\n • ${binding.path}`;
|
|
131
|
+
} else {
|
|
132
|
+
text += `\n - ${binding.path}`;
|
|
150
133
|
}
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
scheme.devices.forEach(device => {
|
|
154
|
-
text += `\n • ${device.controlPath}`;
|
|
155
|
-
if (device.isOptional) {
|
|
156
|
-
text += ' (optional)';
|
|
157
|
-
}
|
|
158
|
-
});
|
|
134
|
+
if (binding.groups) {
|
|
135
|
+
text += ` [${binding.groups}]`;
|
|
159
136
|
}
|
|
160
|
-
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
161
140
|
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
162
143
|
|
|
163
|
-
|
|
164
|
-
|
|
144
|
+
if (result.controlSchemes && Array.isArray(result.controlSchemes)) {
|
|
145
|
+
text += `\n\n## Control Schemes (${result.controlSchemes.length}):`;
|
|
146
|
+
result.controlSchemes.forEach(scheme => {
|
|
147
|
+
text += `\n- ${scheme.name}`;
|
|
148
|
+
if (scheme.bindingGroup) {
|
|
149
|
+
text += ` (Group: ${scheme.bindingGroup})`;
|
|
150
|
+
}
|
|
151
|
+
if (scheme.devices && Array.isArray(scheme.devices)) {
|
|
152
|
+
text += `\n Devices:`;
|
|
153
|
+
scheme.devices.forEach(device => {
|
|
154
|
+
text += `\n • ${device.controlPath}`;
|
|
155
|
+
if (device.isOptional) {
|
|
156
|
+
text += ' (optional)';
|
|
157
|
+
}
|
|
158
|
+
});
|
|
165
159
|
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
166
162
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{
|
|
170
|
-
type: 'text',
|
|
171
|
-
text: text
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
isError: false
|
|
175
|
-
};
|
|
176
|
-
} catch (error) {
|
|
177
|
-
return {
|
|
178
|
-
content: [
|
|
179
|
-
{
|
|
180
|
-
type: 'text',
|
|
181
|
-
text: `Failed to get Input Actions state: ${error.message}`
|
|
182
|
-
}
|
|
183
|
-
],
|
|
184
|
-
isError: true
|
|
185
|
-
};
|
|
163
|
+
if (result.jsonStructure) {
|
|
164
|
+
text += `\n\n## JSON Structure:\n\`\`\`json\n${JSON.stringify(result.jsonStructure, null, 2)}\n\`\`\``;
|
|
186
165
|
}
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
content: [
|
|
169
|
+
{
|
|
170
|
+
type: 'text',
|
|
171
|
+
text: text
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
isError: false
|
|
175
|
+
};
|
|
176
|
+
} catch (error) {
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{
|
|
180
|
+
type: 'text',
|
|
181
|
+
text: `Failed to get Input Actions state: ${error.message}`
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
isError: true
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// Handler for analyze_input_actions_asset
|
|
190
190
|
export async function analyzeInputActionsAssetHandler(unityConnection, args) {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
191
|
+
try {
|
|
192
|
+
// Check connection
|
|
193
|
+
if (!unityConnection.isConnected()) {
|
|
194
|
+
return {
|
|
195
|
+
content: [
|
|
196
|
+
{
|
|
197
|
+
type: 'text',
|
|
198
|
+
text: 'Failed to analyze Input Actions asset: Unity connection not available'
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
isError: true
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
204
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
// Validate required parameters
|
|
206
|
+
if (!args.assetPath) {
|
|
207
|
+
return {
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: 'Failed to analyze Input Actions asset: assetPath is required'
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
isError: true
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
// Send command to Unity
|
|
219
|
+
const result = await unityConnection.sendCommand('input_actions_asset_analyze', args);
|
|
220
220
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
221
|
+
// Check for errors
|
|
222
|
+
if (!result || typeof result === 'string') {
|
|
223
|
+
return {
|
|
224
|
+
content: [
|
|
225
|
+
{
|
|
226
|
+
type: 'text',
|
|
227
|
+
text: `Failed to analyze Input Actions asset: Invalid response format`
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
isError: true
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
234
|
+
if (result.error) {
|
|
235
|
+
return {
|
|
236
|
+
content: [
|
|
237
|
+
{
|
|
238
|
+
type: 'text',
|
|
239
|
+
text: `Failed to analyze Input Actions asset: ${result.error}`
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
isError: true
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
246
|
+
// Format the response
|
|
247
|
+
let text = `# Input Actions Analysis: ${result.assetName}`;
|
|
248
|
+
text += `\n\nPath: ${result.assetPath}`;
|
|
249
|
+
text += `\nAction Maps: ${result.actionMapCount}`;
|
|
250
250
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (result.statistics.devicesUsed && Array.isArray(result.statistics.devicesUsed)) {
|
|
258
|
-
text += `\n- Devices Used: ${result.statistics.devicesUsed.join(', ')}`;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
251
|
+
if (result.statistics) {
|
|
252
|
+
text += `\n\n## Statistics:`;
|
|
253
|
+
text += `\n- Total Actions: ${result.statistics.totalActions}`;
|
|
254
|
+
text += `\n- Total Bindings: ${result.statistics.totalBindings}`;
|
|
255
|
+
text += `\n- Total Control Schemes: ${result.statistics.totalControlSchemes}`;
|
|
261
256
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
text += `\n\n### ${map.name}`;
|
|
267
|
-
text += `\n- Actions: ${map.actionCount}`;
|
|
268
|
-
text += `\n- Bindings: ${map.bindingCount}`;
|
|
269
|
-
|
|
270
|
-
if (map.actions && Array.isArray(map.actions)) {
|
|
271
|
-
text += `\n\n#### Actions:`;
|
|
272
|
-
map.actions.forEach(action => {
|
|
273
|
-
text += `\n\n**${action.name}** (${action.type})`;
|
|
274
|
-
text += `\n- ID: ${action.id}`;
|
|
275
|
-
text += `\n- Expected Control: ${action.expectedControlType || 'Any'}`;
|
|
276
|
-
text += `\n- Bindings: ${action.bindingCount}`;
|
|
277
|
-
|
|
278
|
-
if (action.bindings && Array.isArray(action.bindings)) {
|
|
279
|
-
text += `\n\n Bindings:`;
|
|
280
|
-
action.bindings.forEach((binding, index) => {
|
|
281
|
-
if (binding.isComposite) {
|
|
282
|
-
text += `\n ${index + 1}. **Composite**: ${binding.name || 'Unnamed'}`;
|
|
283
|
-
} else if (binding.isPartOfComposite) {
|
|
284
|
-
text += `\n - ${binding.name}: ${binding.path}`;
|
|
285
|
-
} else {
|
|
286
|
-
text += `\n ${index + 1}. ${binding.path}`;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
if (binding.groups) {
|
|
290
|
-
text += ` [${binding.groups}]`;
|
|
291
|
-
}
|
|
292
|
-
if (binding.interactions) {
|
|
293
|
-
text += `\n Interactions: ${binding.interactions}`;
|
|
294
|
-
}
|
|
295
|
-
if (binding.processors) {
|
|
296
|
-
text += `\n Processors: ${binding.processors}`;
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
}
|
|
257
|
+
if (result.statistics.devicesUsed && Array.isArray(result.statistics.devicesUsed)) {
|
|
258
|
+
text += `\n- Devices Used: ${result.statistics.devicesUsed.join(', ')}`;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
304
261
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
262
|
+
if (result.actionMaps && Array.isArray(result.actionMaps)) {
|
|
263
|
+
text += `\n\n## Detailed Action Maps:`;
|
|
264
|
+
|
|
265
|
+
result.actionMaps.forEach(map => {
|
|
266
|
+
text += `\n\n### ${map.name}`;
|
|
267
|
+
text += `\n- Actions: ${map.actionCount}`;
|
|
268
|
+
text += `\n- Bindings: ${map.bindingCount}`;
|
|
308
269
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
270
|
+
if (map.actions && Array.isArray(map.actions)) {
|
|
271
|
+
text += `\n\n#### Actions:`;
|
|
272
|
+
map.actions.forEach(action => {
|
|
273
|
+
text += `\n\n**${action.name}** (${action.type})`;
|
|
274
|
+
text += `\n- ID: ${action.id}`;
|
|
275
|
+
text += `\n- Expected Control: ${action.expectedControlType || 'Any'}`;
|
|
276
|
+
text += `\n- Bindings: ${action.bindingCount}`;
|
|
277
|
+
|
|
278
|
+
if (action.bindings && Array.isArray(action.bindings)) {
|
|
279
|
+
text += `\n\n Bindings:`;
|
|
280
|
+
action.bindings.forEach((binding, index) => {
|
|
281
|
+
if (binding.isComposite) {
|
|
282
|
+
text += `\n ${index + 1}. **Composite**: ${binding.name || 'Unnamed'}`;
|
|
283
|
+
} else if (binding.isPartOfComposite) {
|
|
284
|
+
text += `\n - ${binding.name}: ${binding.path}`;
|
|
285
|
+
} else {
|
|
286
|
+
text += `\n ${index + 1}. ${binding.path}`;
|
|
314
287
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
} catch (error) {
|
|
319
|
-
return {
|
|
320
|
-
content: [
|
|
321
|
-
{
|
|
322
|
-
type: 'text',
|
|
323
|
-
text: `Failed to analyze Input Actions asset: ${error.message}`
|
|
288
|
+
|
|
289
|
+
if (binding.groups) {
|
|
290
|
+
text += ` [${binding.groups}]`;
|
|
324
291
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
292
|
+
if (binding.interactions) {
|
|
293
|
+
text += `\n Interactions: ${binding.interactions}`;
|
|
294
|
+
}
|
|
295
|
+
if (binding.processors) {
|
|
296
|
+
text += `\n Processors: ${binding.processors}`;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
if (result.jsonStructure) {
|
|
306
|
+
text += `\n\n## Raw JSON Structure:\n\`\`\`json\n${JSON.stringify(result.jsonStructure, null, 2)}\n\`\`\``;
|
|
328
307
|
}
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
content: [
|
|
311
|
+
{
|
|
312
|
+
type: 'text',
|
|
313
|
+
text: text
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
isError: false
|
|
317
|
+
};
|
|
318
|
+
} catch (error) {
|
|
319
|
+
return {
|
|
320
|
+
content: [
|
|
321
|
+
{
|
|
322
|
+
type: 'text',
|
|
323
|
+
text: `Failed to analyze Input Actions asset: ${error.message}`
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
isError: true
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
329
|
}
|