Skip to main content
Glama
object_tools.cpython-312.pyc9.12 kB
� ���gN��H�dZddlmZmZmZmZddlmZmZddl m Z defd�Z y)z4Tools for inspecting and manipulating Unity objects.�)�Optional�List�Dict�Any)�FastMCP�Context)�get_unity_connection�mcpc��|j�dtdtdtttffd��}|j�dtdtdtdtttffd��}|j�dtdtdt tttffd��}|j�dtd tdt tttffd ��}|j�dtdtttffd ��}|j�dtdtttffd ��}|j�dtdtdtttffd ��}|j�dtdt tttffd��}|j� ddtdt tdtdtdt tttff d��} y)zJRegister all object inspection and manipulation tools with the MCP server.�ctx�name�returnc�� t�jdd|i�}|S#t$r}ddt|���icYd}~Sd}~wwxYw)aGet all properties of a specified game object. Args: ctx: The MCP context name: Name of the game object to inspect Returns: Dict containing the object's properties, components, and their values �GET_OBJECT_PROPERTIESr �errorz!Failed to get object properties: N�r � send_command� Exception�str�r r �response�es ��C:\1_Sagyo\VRchat\Project\IshouJidouChouseiToul\Library\PackageCache\com.zundamonnovrchat.unity-mcp-ollama@994ecdcda9\Python\tools\object_tools.py�get_object_propertiesz4register_object_tools.<locals>.get_object_properties sY�� K�+�-�:�:�;R���U��H��O��� K��@��Q���I�J� J�� K��� � A�>�A�A� object_name�component_typec�� t�jd||d��}|S#t$r}ddt|���icYd}~Sd}~wwxYw)a9Get properties of a specific component on a game object. Args: ctx: The MCP context object_name: Name of the game object component_type: Type of the component to inspect Returns: Dict containing the component's properties and their values �GET_COMPONENT_PROPERTIES)rrrz$Failed to get component properties: Nr)r rrrrs r�get_component_propertiesz7register_object_tools.<locals>.get_component_properties sZ��  N�+�-�:�:�;U�*�"0�X��H��O��� N��C�C��F�8�L�M� M�� N�s�!� A�?�A�Ac�� t�jdd|i�}|jdg�S#t$r}ddt |���igcYd}~Sd}~wwxYw)z�Find game objects in the scene by name. Args: ctx: The MCP context name: Name to search for (partial matches are supported) Returns: List of dicts containing object names and their paths �FIND_OBJECTS_BY_NAMEr �objectsr�Failed to find objects: N�r r�getrrrs r�find_objects_by_namez3register_object_tools.<locals>.find_objects_by_name9sh�� D�+�-�:�:�;Q���T��H��<�<� �2�.� .��� D�� 8��Q���A�B�C� C�� D���-0� A�A� A�A�tagc�� t�jdd|i�}|jdg�S#t$r}ddt |���igcYd}~Sd}~wwxYw)z�Find game objects in the scene by tag. Args: ctx: The MCP context tag: Tag to search for Returns: List of dicts containing object names and their paths �FIND_OBJECTS_BY_TAGr)r#rr$Nr%)r r)rrs r�find_objects_by_tagz2register_object_tools.<locals>.find_objects_by_tagOsh�� D�+�-�:�:�;P��s�S��H��<�<� �2�.� .��� D�� 8��Q���A�B�C� C�� D�r(c�� t�jd�}|S#t$r}ddt|���icYd}~Sd}~wwxYw)z�Get information about the current scene. Args: ctx: The MCP context Returns: Dict containing scene information including name and root objects �GET_SCENE_INFOrzFailed to get scene info: Nr�r rrs r�get_scene_infoz-register_object_tools.<locals>.get_scene_infoesJ�� D�+�-�:�:�;K�L�H��O��� D��9�#�a�&��B�C� C�� D���� A�;�A�Ac�� t�jd�}|S#t$r}ddt|���icYd}~Sd}~wwxYw)z�Get the current hierarchy of game objects in the scene. Args: ctx: The MCP context Returns: Dict containing the scene hierarchy as a tree structure � GET_HIERARCHYrzFailed to get hierarchy: Nrr/s r� get_hierarchyz,register_object_tools.<locals>.get_hierarchyusI�� C�+�-�:�:�?�K�H��O��� C��8��Q���A�B� B�� C�r1c�� t�jdd|i�}|S#t$r}ddt|���icYd}~Sd}~wwxYw)z�Select a game object in the Unity Editor. Args: ctx: The MCP context name: Name of the object to select Returns: Dict containing the name of the selected object � SELECT_OBJECTr rzFailed to select object: Nrrs r� select_objectz,register_object_tools.<locals>.select_object�sX�� C�+�-�:�:�?���M��H��O��� C��8��Q���A�B� B�� C�rc�� t�jd�}|jd�S#t$r}ddt |���icYd}~Sd}~wwxYw)z�Get the currently selected game object in the Unity Editor. Args: ctx: The MCP context Returns: Dict containing the selected object's name and path, or None if no object is selected �GET_SELECTED_OBJECT�selectedrzFailed to get selected object: Nr%r/s r�get_selected_objectz2register_object_tools.<locals>.get_selected_object�sT�� I�+�-�:�:�;P�Q�H��<�<� �+� +��� I��>�s�1�v�h�G�H� H�� I�s�),� A�A �A� AN�type�search_pattern�folderc�� t�jd|||d��}|jdg�S#t$r}ddt |���igcYd}~Sd}~wwxYw)aVGet a list of assets in the project. Args: ctx: The MCP context type: Optional asset type to filter by search_pattern: Pattern to search for in asset names folder: Folder to search in (default: "Assets") Returns: List of dicts containing asset information �GET_ASSET_LIST)r<r=r>�assetsrzFailed to get asset list: Nr%)r r<r=r>rrs r�get_asset_listz-register_object_tools.<locals>.get_asset_list�sl��$ F�+�-�:�:�;K��"0� �N��H� �<�<��"�-� -��� F�� :�3�q�6�(�C�D�E� E�� F�s�/2� A�A� A�A)N�*�Assets)�toolrrrrrr) r rr r'r,r0r4r7r;rBs r�register_object_toolsrFsh�� �X�X�Z�K� �K��K� �c�3�h��K��K�* �X�X�Z�N� �N��N��N� �c�3�h�� N��N�0 �X�X�Z�D� �D��D� �d�3��8�n� �D��D�* �X�X�Z�D� �D� �D� �d�3��8�n� �D��D�* �X�X�Z� D�G� D��S�#�X�� D�� D� �X�X�Z� C�7� C�t�C��H�~� C�� C� �X�X�Z�C� �C��C� �c�3�h��C��C�* �X�X�Z� I�� I�X�d�3��8�n�-E� I�� I� �X�X�Z�#�!�� F� �F��s�m�F��F�� F� �d�3��8�n� � F��F�N) �__doc__�typingrrrr�mcp.server.fastmcprr�unity_connectionr rF�rGr�<module>rMs$��:�,�,�/�1�~F�w�~FrG

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ZundamonnoVRChatkaisetu/unity-mcp-ollama'

If you have feedback or need assistance with the MCP directory API, please join our Discord server