Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

get_digitalocean_droplet_info

Retrieve detailed information about DigitalOcean droplets using either their public IP address or droplet ID to monitor status, track resources, and manage cloud servers.

Instructions

获取DigitalOcean Droplet信息

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ip_address_or_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • main.py:378-394 (handler)
    The MCP tool handler for 'get_digitalocean_droplet_info', decorated with @mcp.tool(). Dispatches to provider methods based on whether input is numeric ID or IP address.
    @mcp.tool()
    def get_digitalocean_droplet_info(ip_address_or_id: str) -> Dict:
        """
        获取DigitalOcean Droplet信息
        
        Args:
            ip_address_or_id (str): 公网IP地址或Droplet ID
            
        Returns:
            Dict: Droplet信息
        """
        # 判断是IP地址还是Droplet ID
        if ip_address_or_id.isdigit():
            return digitalocean_provider.get_droplet_by_id(int(ip_address_or_id))
        else:
            return digitalocean_provider.get_droplet_by_ip(ip_address_or_id)
  • Helper method to find DigitalOcean Droplet by public IPv4 address by listing all droplets and matching networks.
    def get_droplet_by_ip(self, ip_address: str) -> Dict:
        """
        根据公网IP地址查找Droplet
        
        Args:
            ip_address (str): 公网IP地址
            
        Returns:
            Dict: Droplet信息或错误信息
        """
        if not self.available:
            return {
                'error': f'DigitalOcean服务不可用: {getattr(self, "error", "未知错误")}',
                'provider': 'digitalocean'
            }
        
        try:
            response = self.client.droplets.list()
            droplets = response.get("droplets", [])
            
            for droplet in droplets:
                networks = droplet.get("networks", {})
                ipv4_networks = networks.get("v4", [])
                
                for network in ipv4_networks:
                    if network.get("type") == "public" and network.get("ip_address") == ip_address:
                        droplet_info = self._format_droplet_info(droplet)
                        return {
                            'provider': 'digitalocean',
                            'found': True,
                            'droplet_info': droplet_info
                        }
            
            return {
                'provider': 'digitalocean',
                'found': False,
                'message': f'未找到使用IP地址 {ip_address} 的Droplet',
                'total_droplets_checked': len(droplets)
            }
            
        except Exception as e:
            return {
                'error': f'查询Droplet时发生错误: {str(e)}',
                'provider': 'digitalocean'
            }
  • Helper method to retrieve specific DigitalOcean Droplet by its integer ID.
    def get_droplet_by_id(self, droplet_id: int) -> Dict:
        """
        根据Droplet ID查找信息
        
        Args:
            droplet_id (int): Droplet ID
            
        Returns:
            Dict: Droplet信息或错误信息
        """
        if not self.available:
            return {
                'error': f'DigitalOcean服务不可用: {getattr(self, "error", "未知错误")}',
                'provider': 'digitalocean'
            }
        
        try:
            response = self.client.droplets.get(droplet_id)
            droplet = response.get("droplet", {})
            
            if not droplet:
                return {
                    'provider': 'digitalocean',
                    'found': False,
                    'message': f'未找到ID为 {droplet_id} 的Droplet'
                }
            
            droplet_info = self._format_droplet_info(droplet)
            return {
                'provider': 'digitalocean',
                'found': True,
                'droplet_info': droplet_info
            }
            
        except Exception as e:
            return {
                'error': f'查询Droplet时发生错误: {str(e)}',
                'provider': 'digitalocean'
            }
  • Private helper to format raw API response of a droplet into a clean structured dictionary used by the query methods.
    def _format_droplet_info(self, droplet: Dict) -> Dict:
        """格式化Droplet详细信息"""
        networks = droplet.get("networks", {})
        
        # 获取IP地址
        public_ip = None
        private_ip = None
        public_ipv6 = None
        
        for net in networks.get("v4", []):
            if net.get("type") == "public":
                public_ip = net.get("ip_address")
            elif net.get("type") == "private":
                private_ip = net.get("ip_address")
        
        for net in networks.get("v6", []):
            if net.get("type") == "public":
                public_ipv6 = net.get("ip_address")
        
        return {
            'id': droplet.get("id"),
            'name': droplet.get("name"),
            'status': droplet.get("status"),
            'size_slug': droplet.get("size_slug"),
            'memory': droplet.get("memory"),
            'vcpus': droplet.get("vcpus"),
            'disk': droplet.get("disk"),
            'region': droplet.get("region", {}).get("name"),
            'region_slug': droplet.get("region", {}).get("slug"),
            'image': {
                'id': droplet.get("image", {}).get("id"),
                'name': droplet.get("image", {}).get("name"),
                'distribution': droplet.get("image", {}).get("distribution"),
                'slug': droplet.get("image", {}).get("slug")
            },
            'public_ipv4': public_ip,
            'private_ipv4': private_ip,
            'public_ipv6': public_ipv6,
            'features': droplet.get("features", []),
            'tags': droplet.get("tags", []),
            'created_at': droplet.get("created_at"),
            'volume_ids': droplet.get("volume_ids", []),
            'vpc_uuid': droplet.get("vpc_uuid")
        }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it states the tool '获取DigitalOcean Droplet信息' (gets Droplet information), it doesn't describe what specific information is returned, whether this is a read-only operation, what happens if the droplet doesn't exist, authentication requirements, rate limits, or any error conditions. For a tool with zero annotation coverage, this represents significant gaps in behavioral transparency.

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 appropriately concise with three clear sections: purpose statement, parameter explanation, and return value indication. Each sentence earns its place, though the structure could be slightly improved by front-loading more behavioral context. The bilingual nature (Chinese purpose, English parameter names) is efficient but might cause minor parsing issues for some agents.

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 that there's an output schema (which should document the return structure), the description doesn't need to detail return values. However, for a tool with no annotations and multiple sibling tools, the description should provide more context about when to use this specific tool, what authentication is required, and what happens in error cases. The parameter explanation is good, but overall completeness is only adequate.

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 context for the single parameter by explaining that 'ip_address_or_id' accepts either a public IP address or a Droplet ID. This is valuable semantic information since the schema only shows it's a string with 0% description coverage. The description compensates well for the schema's lack of parameter documentation, though it doesn't specify format requirements (e.g., IP address format, ID format).

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 tool's purpose as '获取DigitalOcean Droplet信息' (Get DigitalOcean Droplet information), which is a specific verb+resource combination. It distinguishes itself from sibling tools like 'list_digitalocean_droplets' (which lists multiple droplets) and 'get_digitalocean_droplet_monitoring' (which focuses on monitoring data). However, it doesn't explicitly differentiate from 'get_instance_info' or 'get_instance_by_provider' which might serve similar functions across providers.

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 provides no guidance on when to use this tool versus alternatives. It doesn't mention when this tool is appropriate compared to 'list_digitalocean_droplets' (for listing all droplets) or 'get_digitalocean_droplet_monitoring' (for performance metrics). There's also no mention of prerequisites like authentication requirements or rate limits that might affect usage decisions.

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