11using System ;
22using System . Collections . Generic ;
3- using System . Linq ;
43using System . IO ;
54using MCPForUnity . Editor . Helpers ;
65using Newtonsoft . Json . Linq ;
@@ -26,10 +25,6 @@ public static class ManagePrefabs
2625 private const string ACTION_GET_HIERARCHY = "get_hierarchy" ;
2726 private const string SupportedActions = ACTION_OPEN_STAGE + ", " + ACTION_CLOSE_STAGE + ", " + ACTION_SAVE_OPEN_STAGE + ", " + ACTION_CREATE_FROM_GAMEOBJECT + ", " + ACTION_GET_INFO + ", " + ACTION_GET_HIERARCHY ;
2827
29- // Pagination constants
30- private const int DefaultPageSize = 50 ;
31- private const int MaxPageSize = 500 ;
32-
3328 public static object HandleCommand ( JObject @params )
3429 {
3530 if ( @params == null )
@@ -556,6 +551,7 @@ private static object GetInfo(JObject @params)
556551
557552 /// <summary>
558553 /// Gets the hierarchical structure of a prefab asset.
554+ /// Returns all objects in the prefab for full client-side filtering and search.
559555 /// </summary>
560556 private static object GetHierarchy ( JObject @params )
561557 {
@@ -571,11 +567,6 @@ private static object GetHierarchy(JObject @params)
571567 return new ErrorResponse ( $ "Invalid prefab path '{ prefabPath } '. Path traversal sequences are not allowed.") ;
572568 }
573569
574- // Parse pagination parameters
575- var pagination = PaginationRequest . FromParams ( @params , defaultPageSize : DefaultPageSize ) ;
576- int pageSize = Mathf . Clamp ( pagination . PageSize , 1 , MaxPageSize ) ;
577- int cursor = pagination . Cursor ;
578-
579570 // Load prefab contents in background (without opening stage UI)
580571 GameObject prefabContents = PrefabUtility . LoadPrefabContents ( sanitizedPath ) ;
581572 if ( prefabContents == null )
@@ -585,29 +576,16 @@ private static object GetHierarchy(JObject @params)
585576
586577 try
587578 {
588- // Build hierarchy items
579+ // Build complete hierarchy items (no pagination)
589580 var allItems = BuildHierarchyItems ( prefabContents . transform ) ;
590- int totalCount = allItems . Count ;
591-
592- // Apply pagination
593- int startIndex = Mathf . Min ( cursor , totalCount ) ;
594- int endIndex = Mathf . Min ( startIndex + pageSize , totalCount ) ;
595- var paginatedItems = allItems . Skip ( startIndex ) . Take ( endIndex - startIndex ) . ToList ( ) ;
596-
597- bool truncated = endIndex < totalCount ;
598- string nextCursor = truncated ? endIndex . ToString ( ) : null ;
599581
600582 return new SuccessResponse (
601- $ "Successfully retrieved prefab hierarchy. Found { totalCount } objects.",
583+ $ "Successfully retrieved prefab hierarchy. Found { allItems . Count } objects.",
602584 new
603585 {
604586 prefabPath = sanitizedPath ,
605- cursor = cursor . ToString ( ) ,
606- pageSize = pageSize ,
607- nextCursor = nextCursor ,
608- truncated = truncated ,
609- total = totalCount ,
610- items = paginatedItems
587+ total = allItems . Count ,
588+ items = allItems
611589 }
612590 ) ;
613591 }
0 commit comments