Skip to main content
Glama

get_programs

Retrieve all programs from a Universal Robots collaborative robot using SSH credentials to access and list available automation sequences.

Instructions

获取指定IP机器人的所有程序。 IP:机器人地址 username:ssh账号 password:ssh密码

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYes
usernameNoroot
passwordNoeasybot

Implementation Reference

  • The handler function for the 'get_programs' MCP tool. It establishes an SSH connection to the Universal Robot at the specified IP address using provided credentials, changes to the /programs directory, lists files, filters for .urp program files, and returns the list of programs.
    @mcp.tool()
    def get_programs(ip: str, username='root', password='easybot'):
        """获取指定IP机器人的所有程序。
        IP:机器人地址
        username:ssh账号
        password:ssh密码
        """
        try:
            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            ssh.connect(hostname=ip, port=22, username=username, password=password)
            # 创建交互式 shell
            shell = ssh.invoke_shell()
            # 执行多个命令
            shell.send('cd /programs\n')
            shell.send('ls -1\n')
            # 获取输出
            import time
            time.sleep(1)  # 等待命令执行
            output = shell.recv(65535).decode()
            ssh.close()
            files = []
            for file in output.split('\n'):
                name = file.replace(' ', '').replace('\r', '')
                if name.endswith('.urp'):
                    files.append(name)
            logger.info(f"{str(files)}")
            return return_msg(f"命令已发送:{str(files)}")
        except Exception as e:
            return return_msg(f"程序列表获取失败。{str(e)}")

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/nonead/nUR_MCP_SERVER'

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