Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

power_off_vultr_instance

Shut down a Vultr cloud instance with triple confirmation for safety. Use this tool to power off servers when not needed to manage costs or perform maintenance.

Instructions

强制关闭Vultr实例(需要三次确认)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes
ip_confirmationNo
name_confirmationNo
operation_confirmationNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:512-524 (handler)
    MCP tool handler for 'power_off_vultr_instance'. Registers the tool and delegates execution to vultr_provider.power_off_instance with security confirmations.
    @mcp.tool()
    def power_off_vultr_instance(
        instance_id: str, 
        ip_confirmation: str = "", 
        name_confirmation: str = "", 
        operation_confirmation: str = ""
    ) -> Dict:
        """
        强制关闭Vultr实例(需要三次确认)
        """
        return vultr_provider.power_off_instance(
            instance_id, ip_confirmation, name_confirmation, operation_confirmation
        )
  • Core implementation of power operations for Vultr instances, including triple confirmation check, API call to halt the instance via POST /instances/{id}/actions with {'action': 'halt'}.
    def _execute_power_operation(
        self, 
        instance_id: str, 
        operation: str, 
        ip_confirmation: str, 
        name_confirmation: str, 
        operation_confirmation: str
    ) -> 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 {
                    'error': f'未找到ID为 {instance_id} 的Vultr实例',
                    'provider': 'vultr'
                }
            
            if response.status_code != 200:
                return {
                    'error': f'获取实例信息失败: {response.status_code} - {response.text}',
                    'provider': 'vultr'
                }
            
            data = response.json()
            instance = data.get('instance', {})
            
            # 格式化实例信息用于确认
            instance_info = self._format_instance_for_confirmation(instance)
            
        except Exception as e:
            return {
                'error': f'获取Vultr实例信息时发生错误: {str(e)}',
                'provider': 'vultr'
            }
        
        # 检查是否提供了确认信息
        if not ip_confirmation or not name_confirmation or not operation_confirmation:
            # 转换操作名称
            operation_mapping = {
                'start': 'power_on',
                'halt': 'power_off', 
                'reboot': 'reboot'
            }
            mapped_operation = operation_mapping.get(operation, operation)
            return require_triple_confirmation(instance_info, mapped_operation)
        
        # 验证确认信息
        security = SecurityConfirmation()
        operation_mapping = {
            'start': 'power_on',
            'halt': 'power_off',
            'reboot': 'reboot'
        }
        mapped_operation = operation_mapping.get(operation, operation)
        
        is_valid, error_message = security.validate_power_operation(
            instance_info, mapped_operation, ip_confirmation, name_confirmation, operation_confirmation
        )
        
        if not is_valid:
            return {
                'error': f'确认验证失败: {error_message}',
                'provider': 'vultr',
                'requires_confirmation': True
            }
        
        # 执行实际操作
        try:
            operation_data = {'action': operation}
            response = requests.post(
                f'{self.base_url}/instances/{instance_id}/actions',
                headers=self.headers,
                json=operation_data,
                timeout=10
            )
            
            if response.status_code not in [200, 202, 204]:
                return {
                    'error': f'执行 {operation} 操作失败: {response.status_code} - {response.text}',
                    'provider': 'vultr'
                }
            
            return {
                'provider': 'vultr',
                'instance_id': instance_id,
                'operation_success': True,
                'operation': operation,
                'message': f'已成功提交 {operation} 操作',
                'confirmation_validated': True
            }
            
        except Exception as e:
            return {
                'error': f'执行 {operation} 操作时发生错误: {str(e)}',
                'provider': 'vultr'
            }
  • VultrProvider method that handles power_off logic by calling the shared _execute_power_operation with 'halt' action.
    def power_off_instance(
        self, 
        instance_id: str, 
        ip_confirmation: str = "", 
        name_confirmation: str = "", 
        operation_confirmation: str = ""
    ) -> Dict:
        """
        强制关闭Vultr实例(需要三次确认)
        """
        return self._execute_power_operation(
            instance_id, 'halt', ip_confirmation, name_confirmation, operation_confirmation
        )
  • Global instance creation of VultrProvider, imported and used by main.py tool handlers.
    # 全局实例
  • main.py:14-14 (registration)
    Import of vultr_provider module in main.py, enabling tool delegation.
    from providers.vultr_provider import vultr_provider
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates this is a forceful shutdown operation requiring three confirmations, which suggests it's destructive and has safety mechanisms. However, it lacks details on permissions needed, rate limits, whether the action is reversible, what happens to data, or the expected response format. For a destructive operation, this is insufficient.

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

Conciseness5/5

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

The description is extremely concise—a single sentence in Chinese that states the action and a key requirement. It's front-loaded with the core purpose and wastes no words, making it efficient for quick understanding.

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

Completeness2/5

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

Given the tool's complexity (a destructive operation with 4 parameters, 0% schema coverage, no annotations, but with an output schema), the description is incomplete. It doesn't cover parameter details, behavioral traits like safety or permissions, or how it differs from siblings. The output schema might help with return values, but the description lacks essential context for proper use.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions '需要三次确认' (requires three confirmations), which hints at the purpose of the three confirmation parameters (ip_confirmation, name_confirmation, operation_confirmation) but doesn't explain what each confirmation entails or how to provide them. It adds minimal value beyond the parameter names, leaving most semantics unclear.

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

Purpose4/5

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

The description clearly states the action ('强制关闭' meaning 'force shut down') and target resource ('Vultr实例' meaning 'Vultr instance'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'manage_instance_power' or 'shutdown_digitalocean_droplet', which might offer similar functionality for different providers or with different behaviors.

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?

The description mentions '需要三次确认' (requires three confirmations), which provides some context about prerequisites but doesn't specify when to use this tool versus alternatives like 'power_off_alibaba_instance' or 'reboot_vultr_instance'. No explicit guidance on scenarios, exclusions, or comparisons with sibling tools is provided.

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