Skip to main content
Glama
console.cpython-313.pyc8.66 kB
� ��?h|��N�SrSSKJrJrJr SSKJr SSKJr SSK J r S\4Sjr g ) zX Console Handler Handles console session management and command execution in CML labs. �)�Dict�Any�List)�FastMCP�)� get_client)� check_auth�mcpc ��^�UR5S[S[S[[[44Sj5nUR5S[S[S[[[44Sj5nUR5S[S[S[S[[[44Sj5mUR5S[S[S[[S[[[44U4S jj5nUR5SS[S[S [S[[[44U4S jjj5nUR5SS[S [[[4S[[[44Sjj5ng )z5Register console management tools with the MCP server�lab_id�node_id�returnc��# �[5nU(aU$[5RSSUSUS35IShv�N nUR5nSSU3US.$N![anS S [ U530sSnA$SnAff=f7f) z� Open a console session to a node in the lab Args: lab_id: ID of the lab node_id: ID of the node to access Returns: Dictionary with session information �POST� /api/v0/labs/�/nodes/�/consoleN�successz Console session opened for node )�status�message� session_info�errorzError opening console session: )r r�request�json� Exception�str)r r � auth_check�responser�es �UC:\Users\jscon\Documents\Python_Projects\Claude-Modeling-Labs\src\handlers\console.py�open_console_session�4register_console_tools.<locals>.open_console_sessions���� �\� � �� � I�'�\�1�1�&�M�&��QX�Y`�Xa�ai�:j�k�k�H�#�=�=�?�L�#�=�g�Y�G� ,�� �l��� I��>�s�1�v�h�G�H� H�� I�sD�B�$A�A�A�B�A� A?�%A:�4A?�5B�:A?�?Bc���# �[5nU(aU$[5RSSUSUS35IShv�N nSSU3S.$N ![anS S [ U530sSnA$SnAff=f7f) z� Close a console session to a node in the lab Args: lab_id: ID of the lab node_id: ID of the node with an open session Returns: Dictionary with operation status �DELETErrrNrz Console session closed for node )rrrzError closing console session: )r rrrr)r r rrrs r �close_console_session�5register_console_tools.<locals>.close_console_session,s���� �\� � �� � I�'�\�1�1�(�m�F�8�SZ�[b�Zc�ck�<l�m�m�H�#�=�g�Y�G�� �n�� � I��>�s�1�v�h�G�H� H�� I�sD�A1�$A �A� A �A1�A � A.�A)�#A.�$A1�)A.�.A1�commandc��&# �[5nU(aU$[5RSSUSUS3SU0S9IShv�N nUR5nSUUR S S 5US .$N+![ anS S [ U530sSnA$SnAff=f7f)z� Send a command to a node console Args: lab_id: ID of the lab node_id: ID of the node command: Command to send Returns: Dictionary with command output rrrz/console/commandr')rNr�output�)rr'r)�detailsrzError sending console command: )r rrr�getrr)r r r'rr�resultrs r �send_console_command�4register_console_tools.<locals>.send_console_commandEs���� �\� � �� � I�'�\�1�1����x�w�w�i�7G�H���)�2���H� �]�]�_�F�#�"� �*�*�X�r�2�!� � ���� I��>�s�1�v�h�G�H� H�� I�sD�B�%A*�A(�*A*�'B�(A*�* B�4B �B�B� B�B�commandsc���># �[5nU(aU$/nUH%nT"XU5IShv�N nURU5 M' S[U5US.$N(![anSS[ U530sSnA$SnAff=f7f)z� Send multiple commands to a node console Args: lab_id: ID of the lab node_id: ID of the node commands: List of commands to send Returns: Dictionary with command outputs Nr)r� commands_sent�resultsrz!Error sending multiple commands: )r �append�lenrr) r r r0rr3r'�command_resultrr.s �r �send_multiple_commands�6register_console_tools.<locals>.send_multiple_commandsgs����� �\� � �� � K��G�#��';�F�W�'U�!U�����~�.�$� $�!$�X��"�� �"V��� K��@��Q���I�J� J�� K�sD�A=�A�A�'A�A=�A� A:� A5�/A:�0A=�5A:�:A=N�interface_namec��># �[5nU(aU$U(aSU3nOSnT"XU5IShv�N nSU=(d SURSS5US.$N$![anS S [U530sSnA$SnAff=f7f) z� Check interface status on a node Args: lab_id: ID of the lab node_id: ID of the node interface_name: Optional specific interface to check (check all if not specified) Returns: Dictionary with interface status zshow interfaces zshow interfaces briefNrzall interfacesr)r*)r�interface_checkr)� command_usedrzError checking interfaces: )r r,rr)r r r9rr'r-rr.s �r �check_interfaces�0register_console_tools.<locals>.check_interfaces�s����� �\� � �� � E��,�^�,<�=��1��/���I�I�F�$�#1�#E�5E� �*�*�X�r�2� '� � �J��� E��:�3�q�6�(�C�D� D�� E�sD�B�A�A�#A�B�A� A>�$A9�3A>�4B�9A>�>B� report_datac��D# �[5nU(aU$SSKJn U"U5IShv�N n/SQnU(a.SU;aURS5 SU;aURS5 S UUUU=(d S S .$NN![anS S [ U530sSnA$SnAff=f7f)z� Get recommendations based on a troubleshooting report Args: lab_id: ID of the lab report_data: Optional report data from a previous troubleshooting run Returns: Dictionary with recommendations �)�get_lab_topologyN)z(1. Verify all nodes are in STARTED statez72. Check interface status using 'show interfaces brief'z03. Verify IP addressing and subnet configurationz'4. Test connectivity with ping commandsz,5. Check routing tables with 'show ip route'z66. Verify VLAN configuration on switches if applicable�connectivity_issuesz27. Focus on Layer 2/3 connectivity troubleshooting�routing_issueszC8. Review routing protocol configuration and neighbor relationshipsrz No previous report data provided)rr �recommendations�topology_summaryr?rz-Error generating diagnostic recommendations: )r �topologyrBr4rr)r r?rrBrGrErs r �get_diagnostic_recommendations�>register_console_tools.<locals>.get_diagnostic_recommendations�s���� �\� � �� � W� 2�.�f�5�5�H��O��(�K�7�#�*�*�+_�`�#�{�2�#�*�*�+p�q�$� �#2�$,�*�P�.P� � �%6��2� W��L�S�QR�V�H�U�V� V�� W�sE�B �A9�A7�A A9�6B �7A9�9 B�B�B�B �B�B )N)�toolrrrr)r r!r%r7r=rHr.s @r �register_console_toolsrKs���� �X�X�Z�I�3�I��I��c�3�h��I��I�4 �X�X�Z�I�C�I�#�I�$�s�C�x�.�I��I�0 �X�X�Z�I�3�I��I�s�I�t�TW�Y\�T\�~�I��I�B �X�X�Z�K�S�K�3�K�$�s�)�K�X\�]`�be�]e�Xf�K��K�< �X�X�Z�E�s�E�S�E�#�E�Y]�^a�cf�^f�Yg�E��E�B �X�X�Z�.W�S�.W�t�C�QT�H�~�.W�ae�fi�kn�fn�ao�.W��.W�N) �__doc__�typingrrr�fastmcpr�clientr�utilsr rK�rLr �<module>rSs+��� #�"����IW��IWrL

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/MediocreTriumph/claude-cml-toolkit'

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