Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

list_vultr_instances

Retrieve a list of all Vultr cloud server instances to view current deployments and manage resources.

Instructions

列出所有Vultr实例

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:540-546 (handler)
    The MCP tool handler function decorated with @mcp.tool(), which registers and implements the list_vultr_instances tool by delegating to vultr_provider.list_instances().
    @mcp.tool()
    def list_vultr_instances() -> Dict:
        """
        列出所有Vultr实例
        """
        return vultr_provider.list_instances()
  • The supporting method in VultrProvider class that implements the core logic of listing all Vultr instances using the Vultr API v2 /instances endpoint, formatting the response.
    def list_instances(self) -> Dict:
        """
        列出所有Vultr实例
        
        Returns:
            Dict: 实例列表或错误信息
        """
        if not self.available:
            return {
                'error': f'Vultr服务不可用: {getattr(self, "error", "未知错误")}',
                'provider': 'vultr'
            }
        
        try:
            response = requests.get(f'{self.base_url}/instances', headers=self.headers, timeout=10)
            
            if response.status_code != 200:
                return {
                    'error': f'Vultr API调用失败: {response.status_code} - {response.text}',
                    'provider': 'vultr'
                }
            
            data = response.json()
            instances = data.get('instances', [])
            
            instance_list = []
            for instance in instances:
                instance_info = self._format_instance_summary(instance)
                instance_list.append(instance_info)
            
            return {
                'provider': 'vultr',
                'total_instances': len(instance_list),
                'instances': instance_list
            }
            
        except requests.RequestException as e:
            return {
                'error': f'网络请求失败: {str(e)}',
                'provider': 'vultr'
            }
        except Exception as e:
            return {
                'error': f'列出Vultr实例时发生错误: {str(e)}',
                'provider': 'vultr'
            }
  • Global instantiation of the VultrProvider class instance used by the tool handler.
    vultr_provider = VultrProvider() 
  • main.py:540-540 (registration)
    The @mcp.tool() decorator that registers the list_vultr_instances function as an MCP tool.
    @mcp.tool()

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/rainhan99/cloud_manage_mcp_server'

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