Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

get_vultr_instance_info

Retrieve detailed information about Vultr cloud instances using either IP addresses or instance IDs for monitoring and management purposes.

Instructions

获取Vultr实例信息

Args:
    ip_address_or_id (str): 公网IP地址或实例ID
    
Returns:
    Dict: Vultr实例信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ip_address_or_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:481-497 (handler)
    MCP tool handler decorated with @mcp.tool() for registration. Determines if input is IP or ID and delegates to vultr_provider methods.
    @mcp.tool()
    def get_vultr_instance_info(ip_address_or_id: str) -> Dict:
        """
        获取Vultr实例信息
        
        Args:
            ip_address_or_id (str): 公网IP地址或实例ID
            
        Returns:
            Dict: Vultr实例信息
        """
        # Vultr实例ID通常是UUID格式
        if '-' in ip_address_or_id and len(ip_address_or_id) > 20:
            return vultr_provider.get_instance_by_id(ip_address_or_id)
        else:
            return vultr_provider.get_instance_by_ip(ip_address_or_id)
  • Helper method in VultrProvider class to fetch instance by IP address using Vultr API, lists all instances and matches main_ip.
    def get_instance_by_ip(self, ip_address: str) -> Dict:
        """
        根据公网IP地址查找Vultr实例
        
        Args:
            ip_address (str): 公网IP地址
            
        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', [])
            
            # 查找匹配的IP地址
            for instance in instances:
                if instance.get('main_ip') == ip_address:
                    instance_info = self._format_instance_info(instance)
                    return {
                        'provider': 'vultr',
                        'found': True,
                        'instance_info': instance_info
                    }
            
            return {
                'provider': 'vultr',
                'found': False,
                'message': f'未找到使用IP地址 {ip_address} 的Vultr实例',
                'total_instances_checked': len(instances)
            }
            
        except requests.RequestException as e:
            return {
                'error': f'网络请求失败: {str(e)}',
                'provider': 'vultr'
            }
        except Exception as e:
            return {
                'error': f'查询Vultr实例时发生错误: {str(e)}',
                'provider': 'vultr'
            }
  • Helper method in VultrProvider class to fetch instance directly by ID using Vultr API endpoint.
    def get_instance_by_id(self, instance_id: str) -> Dict:
        """
        根据实例ID查找Vultr实例
        
        Args:
            instance_id (str): Vultr实例ID
            
        Returns:
            Dict: 实例信息或错误信息
        """
        if not self.available:
            return {
                'error': f'Vultr服务不可用: {getattr(self, "error", "未知错误")}',
                'provider': 'vultr'
            }
        
        try:
            response = requests.get(f'{self.base_url}/instances/{instance_id}', headers=self.headers, timeout=10)
            
            if response.status_code == 404:
                return {
                    'provider': 'vultr',
                    'found': False,
                    'message': f'未找到ID为 {instance_id} 的Vultr实例'
                }
            
            if response.status_code != 200:
                return {
                    'error': f'Vultr API调用失败: {response.status_code} - {response.text}',
                    'provider': 'vultr'
                }
            
            data = response.json()
            instance = data.get('instance', {})
            instance_info = self._format_instance_info(instance)
            
            return {
                'provider': 'vultr',
                'found': True,
                'instance_info': instance_info
            }
            
        except requests.RequestException as e:
            return {
                'error': f'网络请求失败: {str(e)}',
                'provider': 'vultr'
            }
        except Exception as e:
            return {
                'error': f'查询Vultr实例时发生错误: {str(e)}',
                'provider': 'vultr'
            }
  • Private helper method used by get_instance_by_ip and get_instance_by_id to format the raw API response into a standardized dict.
    def _format_instance_info(self, instance: Dict) -> Dict:
        """格式化实例详细信息"""
        return {
            'id': instance.get('id'),
            'label': instance.get('label', '未命名'),
            'hostname': instance.get('hostname'),
            'status': instance.get('status'),
            'power_status': instance.get('power_status'),
            'server_status': instance.get('server_status'),
            'allowed_bandwidth': instance.get('allowed_bandwidth'),
            'netmask_v4': instance.get('netmask_v4'),
            'gateway_v4': instance.get('gateway_v4'),
            'main_ip': instance.get('main_ip'),
            'v6_main_ip': instance.get('v6_main_ip'),
            'ram': instance.get('ram'),
            'disk': instance.get('disk'),
            'vcpu_count': instance.get('vcpu_count'),
            'region': instance.get('region'),
            'plan': instance.get('plan'),
            'os': instance.get('os'),
            'os_id': instance.get('os_id'),
            'app_id': instance.get('app_id'),
            'firewall_group_id': instance.get('firewall_group_id'),
            'features': instance.get('features', []),
            'tags': instance.get('tags', []),
            'internal_ip': instance.get('internal_ip'),
            'kvm': instance.get('kvm'),
            'date_created': instance.get('date_created')
        }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions the tool '获取' (gets) information, implying a read-only operation, but doesn't disclose behavioral traits like authentication needs, rate limits, error handling, or what specific information is returned. This is inadequate for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and structured with clear sections for Args and Returns. It's front-loaded with the purpose, and each sentence adds value, though the Returns section is minimal given the output schema exists.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema, the description doesn't need to detail return values. However, with no annotations and minimal behavioral context, it's incomplete for guiding usage. It covers the parameter semantics adequately but lacks broader context like when to use it or error cases.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful semantics: it explains that 'ip_address_or_id' accepts either a public IP address or an instance ID. With 0% schema description coverage and only 1 parameter, this clarification compensates well, though it could detail format constraints (e.g., IP format).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states '获取Vultr实例信息' (Get Vultr instance information), which clearly indicates the verb (get) and resource (Vultr instance). However, it doesn't distinguish from sibling tools like 'get_instance_info' or 'get_vultr_instance_bandwidth', making the purpose somewhat vague in context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'get_instance_info' (general) or 'list_vultr_instances' (list all). The description only states what it does, not when it's appropriate, leaving the agent without context for selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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