From 47bb2c63633eb33cc43404c66615836ba1aae43a Mon Sep 17 00:00:00 2001 From: David Sarno Date: Sun, 13 Apr 2025 10:38:53 -0700 Subject: [PATCH] docs: Add documentation for get_components action in manage_gameobject - Add get_components to the list of available actions in the docstring - Document required and optional parameters for get_components action - Clarify the return value structure for get_components - Improve overall documentation clarity for component data retrieval --- UnityMcpServer/src/tools/manage_gameobject.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/UnityMcpServer/src/tools/manage_gameobject.py b/UnityMcpServer/src/tools/manage_gameobject.py index 0f4c9bf..83ab9c7 100644 --- a/UnityMcpServer/src/tools/manage_gameobject.py +++ b/UnityMcpServer/src/tools/manage_gameobject.py @@ -40,7 +40,7 @@ def register_manage_gameobject_tools(mcp: FastMCP): """Manages GameObjects: create, modify, delete, find, and component operations. Args: - action: Operation (e.g., 'create', 'modify', 'find', 'add_component', 'remove_component', 'set_component_property'). + action: Operation (e.g., 'create', 'modify', 'find', 'add_component', 'remove_component', 'set_component_property', 'get_components'). target: GameObject identifier (name or path string) for modify/delete/component actions. search_method: How to find objects ('by_name', 'by_id', 'by_path', etc.). Used with 'find' and some 'target' lookups. name: GameObject name - used for both 'create' (initial name) and 'modify' (rename). @@ -62,8 +62,16 @@ def register_manage_gameobject_tools(mcp: FastMCP): search_term, find_all for 'find'). includeNonPublicSerialized: If True, includes private fields marked [SerializeField] in component data. + Action-specific details: + - For 'get_components': + Required: target, search_method + Optional: includeNonPublicSerialized (defaults to True) + Returns all components on the target GameObject with their serialized data. + The search_method parameter determines how to find the target ('by_name', 'by_id', 'by_path'). + Returns: Dictionary with operation results ('success', 'message', 'data'). + For 'get_components', the 'data' field contains a dictionary of component names and their serialized properties. """ try: # --- Early check for attempting to modify a prefab asset ---