Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

get_vultr_instance_bandwidth

Retrieve bandwidth usage data for a Vultr cloud instance to monitor network consumption and track resource utilization.

Instructions

获取Vultr实例带宽使用情况

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes

Implementation Reference

  • main.py:547-552 (handler)
    MCP tool handler function that registers and executes the tool by delegating to the Vultr provider.
    @mcp.tool()
    def get_vultr_instance_bandwidth(instance_id: str) -> Dict:
        """
        获取Vultr实例带宽使用情况
        """
        return vultr_provider.get_instance_bandwidth(instance_id)
  • Core helper method in VultrProvider class that performs the actual API request to Vultr for instance bandwidth data.
    def get_instance_bandwidth(self, instance_id: str) -> Dict:
        """
        获取实例的带宽使用情况
        
        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}/bandwidth', headers=self.headers, timeout=10)
            
            if response.status_code != 200:
                return {
                    'error': f'获取带宽信息失败: {response.status_code} - {response.text}',
                    'provider': 'vultr'
                }
            
            data = response.json()
            
            return {
                'provider': 'vultr',
                'instance_id': instance_id,
                'bandwidth_data': data.get('bandwidth', {})
            }
            
        except Exception as e:
            return {
                'error': f'获取带宽信息时发生错误: {str(e)}',
                'provider': 'vultr'
            }

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