Skip to main content
Glama
editor_tools.cpython-312.pyc8.31 kB
� ���g��8�ddlmZmZddlmZddlmZdefd�Zy)�)�FastMCP�Context)�Optional)�get_unity_connection�mcpc � �|j�dtdtfd��}|j�dtdtfd��}|j�dtdtfd��}|j�dtdtfd��}|j�dtdtfd��}|j�dtdtd tdtfd ��}|j�ddtd td tdtfd ��}y)z6Register all editor control tools with the MCP server.�ctx�returnc�� t�jdddi�}|jdd�S#t$r}dt |���cYd}~Sd}~wwxYw)z�Undo the last action performed in the Unity editor. Returns: str: Success message or error details �EDITOR_CONTROL�command�UNDO�messagezUndo performed successfullyzError performing undo: N�r� send_command�get� Exception�str�r �response�es ��C:\1_Sagyo\VRchat\Project\IshouJidouChouseiToul\Library\PackageCache\com.zundamonnovrchat.unity-mcp-ollama@994ecdcda9\Python\tools\editor_tools.py�undoz#register_editor_tools.<locals>.undo�]�� 6�+�-�:�:�;K��6�N��H��<�<� �+H�I� I��� 6�,�S��V�H�5� 5�� 6���-0� A� A �A� Ac�� t�jdddi�}|jdd�S#t$r}dt |���cYd}~Sd}~wwxYw)z�Redo the last undone action in the Unity editor. Returns: str: Success message or error details r r �REDOrzRedo performed successfullyzError performing redo: Nrrs r�redoz#register_editor_tools.<locals>.redorrc�� t�jdddi�}|jdd�S#t$r}dt |���cYd}~Sd}~wwxYw)z�Start the game in play mode within the Unity editor. Returns: str: Success message or error details r r �PLAYrzEntered play modezError entering play mode: Nrrs r�playz#register_editor_tools.<locals>.play&s]�� 9�+�-�:�:�;K��6�N��H��<�<� �+>�?� ?��� 9�/��A��x�8� 8�� 9�rc�� t�jdddi�}|jdd�S#t$r}dt |���cYd}~Sd}~wwxYw)zwPause the game while in play mode. Returns: str: Success message or error details r r �PAUSErz Game pausedzError pausing game: Nrrs r�pausez$register_editor_tools.<locals>.pause5s\�� 3�+�-�:�:�;K��7�N��H��<�<� �=�9� 9��� 3�)�#�a�&��2� 2�� 3�rc�� t�jdddi�}|jdd�S#t$r}dt |���cYd}~Sd}~wwxYw)zvStop the game and exit play mode. Returns: str: Success message or error details r r �STOPrzExited play modezError stopping game: Nrrs r�stopz#register_editor_tools.<locals>.stopDs]�� 4�+�-�:�:�;K��6�N��H��<�<� �+=�>� >��� 4�*�3�q�6�(�3� 3�� 4�r�platform� build_pathc��� gd�}|j�|vrd|�ddj|���Sddl}|jj |�}|jj |�sd|�d�S|j ||j�sd|�d �S|jj |�rz|jj|�r"|j ||j�sCd |�d �S|jj|�r"|j ||j�sd |�d �St�jd d ||d�d��}|jdd�S#t$r}dt|���cYd}~Sd}~wwxYw)a)Build the project for a specified platform. Args: platform: Target platform (windows, mac, linux, android, ios, webgl) build_path: Path where the build should be saved Returns: str: Success message or error details )�windows�mac�linux�android�ios�webglzError: 'z0' is not a valid platform. Valid platforms are: �, rNzError: Build directory 'z)' does not exist. Please create it first.z' is not writable.zError: Existing build file 'z!Error: Existing build directory 'r �BUILD)r(� buildPath�r �paramsrzBuild completed successfullyzError building project: )�lower�join�os�path�dirname�exists�access�W_OK�isfile�isdirrrrrr)r r(r)�valid_platformsr8� build_dirrrs r�buildz$register_editor_tools.<locals>.buildSso��& 7�T�O��~�~���6�!�(��+[�\`�\e�\e�fu�\v�[w�x�x� ������ �3�I��7�7�>�>�)�,�1�)��<e�f�f��9�9�Y����0�1�)��<N�O�O��w�w�~�~�j�)��7�7�>�>�*�-��9�9�Z����9�!=�j�\�I[�\�\��W�W�]�]�:�.��9�9�Z����9�!B�:�,�N`�a�a�+�-�:�:�;K�"� (�!+��N��H��<�<� �+I�J� J��� 7�-�c�!�f�X�6� 6�� 7�s;�,E�?E�/!E�AE�)<E�&1E� E9�! E4�.E9�4E9� command_name�validate_commandc��� t�}|r�|jdddi�jdg�}|rp||vrl|D�cgc]%}|j�|j�vs�$|��'}}d}|r0ddj |dd ���}t |�d kDr|d z }n|d z }d |�d |��S|jddd|id��}|jdd|���Scc}w#t $r} dt| ���cYd} ~ Sd} ~ wwxYw)aExecute a specific editor command or custom script within the Unity editor. Args: command_name: Name of the editor command to execute (e.g., "Edit/Preferences") validate_command: Whether to validate the command existence before executing (default: True) Returns: str: Success message or error details r r �GET_AVAILABLE_COMMANDS�commands�z Did you mean one of these: r1N�z or others?�?zError: Command 'z ' not found.�EXECUTE_COMMAND� commandNamer4rzExecuted command: zError executing command: )rrrr6r7�lenrr) r rCrD�unity�available_commands�cmd�similar_commands�suggestion_msgrrs r�execute_commandz.register_editor_tools.<locals>.execute_command�sG�� 8�(�*�E� �%*�%7�%7�8H��7�K�&��3�z�2�&�#� &�,�>P�*P�7I�'q�7I��\�M_�M_�Ma�eh�en�en�ep�Mp��7I�$�'q�%'�N�'�+G�� � �Rb�ce�de�Rf�Hg�Gh�)i���/�0�1�4�*�m�;�N�*�c�1�N�-�l�^�<��GW�X�X��)�)�*:�,�!�<��=��H� �<�<� �-?� �~�+N�O� O��#(r��$� 8�.�s�1�v�h�7� 7�� 8�s:�:C�%C�"C�&=C�$+C�C� C6� C1�+C6�1C6N)T)�toolrr�bool)rrrr!r$r'rBrSs r�register_editor_toolsrVs8�� �X�X�Z� 6�'� 6�c� 6�� 6� �X�X�Z� 6�'� 6�c� 6�� 6� �X�X�Z� 9�'� 9�c� 9�� 9� �X�X�Z� 3�7� 3�s� 3�� 3� �X�X�Z� 4�'� 4�c� 4�� 4� �X�X�Z�07�7�07�c�07�s�07�s�07��07�d �X�X�Z�*8�W�*8�C�*8�4�*8�[^�*8��*8�N)�mcp.server.fastmcprr�typingr�unity_connectionrrV�rWr�<module>r\s��/��1�l8�w�l8rW

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