22using UnityEditor ;
33using System . IO ;
44using Newtonsoft . Json . Linq ;
5- using System . Linq ;
65using System . Collections . Generic ;
76
8- namespace MCPServer . Editor . Commands
7+ namespace UnityMCP . Editor . Commands
98{
109 /// <summary>
1110 /// Handles asset-related commands for the MCP Server
@@ -51,10 +50,11 @@ public static object ImportAsset(JObject @params)
5150 }
5251 catch ( System . Exception e )
5352 {
54- return new {
55- success = false ,
56- error = $ "Failed to import asset: { e . Message } ",
57- stackTrace = e . StackTrace
53+ return new
54+ {
55+ success = false ,
56+ error = $ "Failed to import asset: { e . Message } ",
57+ stackTrace = e . StackTrace
5858 } ;
5959 }
6060 }
@@ -67,16 +67,16 @@ public static object InstantiatePrefab(JObject @params)
6767 try
6868 {
6969 string prefabPath = ( string ) @params [ "prefab_path" ] ;
70-
70+
7171 if ( string . IsNullOrEmpty ( prefabPath ) )
7272 return new { success = false , error = "Prefab path cannot be empty" } ;
7373
74- Vector3 position = new Vector3 (
74+ Vector3 position = new (
7575 ( float ) @params [ "position_x" ] ,
7676 ( float ) @params [ "position_y" ] ,
7777 ( float ) @params [ "position_z" ]
7878 ) ;
79- Vector3 rotation = new Vector3 (
79+ Vector3 rotation = new (
8080 ( float ) @params [ "rotation_x" ] ,
8181 ( float ) @params [ "rotation_y" ] ,
8282 ( float ) @params [ "rotation_z" ]
@@ -93,7 +93,7 @@ public static object InstantiatePrefab(JObject @params)
9393 {
9494 return new { success = false , error = $ "Failed to instantiate prefab: { prefabPath } " } ;
9595 }
96-
96+
9797 instance . transform . position = position ;
9898 instance . transform . rotation = Quaternion . Euler ( rotation ) ;
9999
@@ -106,10 +106,11 @@ public static object InstantiatePrefab(JObject @params)
106106 }
107107 catch ( System . Exception e )
108108 {
109- return new {
110- success = false ,
111- error = $ "Failed to instantiate prefab: { e . Message } ",
112- stackTrace = e . StackTrace
109+ return new
110+ {
111+ success = false ,
112+ error = $ "Failed to instantiate prefab: { e . Message } ",
113+ stackTrace = e . StackTrace
113114 } ;
114115 }
115116 }
@@ -162,9 +163,10 @@ public static object CreatePrefab(JObject @params)
162163 }
163164 catch ( System . Exception e )
164165 {
165- return new {
166- success = false ,
167- error = $ "Failed to create prefab: { e . Message } ",
166+ return new
167+ {
168+ success = false ,
169+ error = $ "Failed to create prefab: { e . Message } ",
168170 stackTrace = e . StackTrace ,
169171 sourceInfo = $ "Object: { @params [ "object_name" ] } , Path: { @params [ "prefab_path" ] } "
170172 } ;
@@ -218,9 +220,9 @@ public static object GetAssetList(JObject @params)
218220 assets . Add ( new
219221 {
220222 name = Path . GetFileNameWithoutExtension ( path ) ,
221- path = path ,
223+ path ,
222224 type = assetType ? . Name ?? "Unknown" ,
223- guid = guid
225+ guid
224226 } ) ;
225227 }
226228
0 commit comments