@@ -16,10 +16,10 @@ def manage_gameobject(
1616 action : Annotated [Literal ["create" , "modify" , "delete" , "find" , "add_component" , "remove_component" , "set_component_property" , "get_components" ], "Perform CRUD operations on GameObjects and components." ],
1717 target : Annotated [str ,
1818 "GameObject identifier by name or path for modify/delete/component actions" ] | None = None ,
19- search_method : Annotated [str ,
20- "How to find objects ('by_name', 'by_id', 'by_path', etc.) . Used with 'find' and some 'target' lookups." ] | None = None ,
19+ search_method : Annotated [Literal [ "by_id" , "by_name" , "by_path" , "by_tag" , "by_layer" , "by_component" ] ,
20+ "How to find objects. Used with 'find' and some 'target' lookups." ] | None = None ,
2121 name : Annotated [str ,
22- "GameObject name - used for both 'create' (initial name) and 'modify' (rename)" ] | None = None ,
22+ "GameObject name for 'create' (initial name) and 'modify' (rename) actions ONLY. For 'find' action, use 'search_term' instead. " ] | None = None ,
2323 tag : Annotated [str ,
2424 "Tag name - used for both 'create' (initial tag) and 'modify' (change tag)" ] | None = None ,
2525 parent : Annotated [str ,
@@ -53,7 +53,7 @@ def manage_gameobject(
5353 - Access shared material: `{"MeshRenderer": {"sharedMaterial.color": [1, 0, 0, 1]}}`""" ] | None = None ,
5454 # --- Parameters for 'find' ---
5555 search_term : Annotated [str ,
56- "Search term for 'find' action" ] | None = None ,
56+ "Search term for 'find' action ONLY. Use this (not 'name') when searching for GameObjects. " ] | None = None ,
5757 find_all : Annotated [bool ,
5858 "If True, finds all GameObjects matching the search term" ] | None = None ,
5959 search_in_children : Annotated [bool ,
@@ -69,6 +69,26 @@ def manage_gameobject(
6969 ) -> dict [str , Any ]:
7070 ctx .info (f"Processing manage_gameobject: { action } " )
7171 try :
72+ # Validate parameter usage to prevent silent failures
73+ if action == "find" :
74+ if name is not None and search_term is None :
75+ return {
76+ "success" : False ,
77+ "message" : "For 'find' action, use 'search_term' parameter, not 'name'. Example: search_term='Player', search_method='by_name'"
78+ }
79+ if search_term is None :
80+ return {
81+ "success" : False ,
82+ "message" : "For 'find' action, 'search_term' parameter is required. Use search_term (not 'name') to specify what to find."
83+ }
84+
85+ if action in ["create" , "modify" ]:
86+ if search_term is not None :
87+ return {
88+ "success" : False ,
89+ "message" : f"For '{ action } ' action, use 'name' parameter, not 'search_term'."
90+ }
91+
7292 # Prepare parameters, removing None values
7393 params = {
7494 "action" : action ,
0 commit comments