Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

get_aws_instance_storage_info

Retrieve storage details for AWS EC2 instances, including disk type, IOPS, and throughput metrics, to monitor and manage cloud resources effectively.

Instructions

获取AWS EC2实例的存储详细信息

Args:
    instance_id (str): EC2实例ID
    
Returns:
    Dict: 存储信息,包括磁盘类型、IOPS、吞吐量等

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instance_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler implementing AWS EC2 instance storage info retrieval using boto3 to fetch block devices and EBS volume details including type, size, IOPS, throughput.
    def get_instance_storage_info(self, instance_id: str) -> Dict:
        """
        获取实例的存储详细信息
        
        Args:
            instance_id (str): EC2实例ID
            
        Returns:
            Dict: 存储信息或错误信息
        """
        if not self.available:
            return {
                'error': f'AWS服务不可用: {getattr(self, "error", "未知错误")}',
                'provider': 'aws'
            }
        
        try:
            # 获取实例信息
            instance_response = self.ec2.describe_instances(InstanceIds=[instance_id])
            if not instance_response['Reservations']:
                return {
                    'error': f'未找到ID为 {instance_id} 的EC2实例',
                    'provider': 'aws'
                }
            
            instance = instance_response['Reservations'][0]['Instances'][0]
            
            # 获取卷信息
            storage_info = []
            
            for block_device in instance.get('BlockDeviceMappings', []):
                volume_id = block_device.get('Ebs', {}).get('VolumeId')
                if volume_id:
                    volume_response = self.ec2.describe_volumes(VolumeIds=[volume_id])
                    if volume_response['Volumes']:
                        volume = volume_response['Volumes'][0]
                        
                        # 获取IOPS和吞吐量信息
                        iops = volume.get('Iops', 'N/A')
                        throughput = volume.get('Throughput', 'N/A')
                        
                        storage_info.append({
                            'device_name': block_device.get('DeviceName'),
                            'volume_id': volume_id,
                            'volume_type': volume.get('VolumeType'),
                            'size': volume.get('Size'),
                            'iops': iops,
                            'throughput': throughput,
                            'encrypted': volume.get('Encrypted', False),
                            'state': volume.get('State'),
                            'created_time': volume.get('CreateTime').isoformat() if volume.get('CreateTime') else None
                        })
            
            return {
                'provider': 'aws',
                'instance_id': instance_id,
                'storage_devices': storage_info,
                'total_devices': len(storage_info)
            }
            
        except ClientError as e:
            return {
                'error': f'AWS API调用失败: {str(e)}',
                'provider': 'aws'
            }
        except Exception as e:
            return {
                'error': f'获取存储信息时发生错误: {str(e)}',
                'provider': 'aws'
            }
  • main.py:341-352 (registration)
    MCP tool registration for 'get_aws_instance_storage_info' which delegates to the AWSProvider instance method.
    @mcp.tool()
    def get_aws_instance_storage_info(instance_id: str) -> Dict:
        """
        获取AWS EC2实例的存储详细信息
        
        Args:
            instance_id (str): EC2实例ID
            
        Returns:
            Dict: 存储信息,包括磁盘类型、IOPS、吞吐量等
        """
        return aws_provider.get_instance_storage_info(instance_id)
  • Global instantiation of AWSProvider class instance used by the tool wrappers.
    aws_provider = AWSProvider() 
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. It states the tool retrieves storage details but doesn't mention whether it's a read-only operation, requires specific AWS permissions, has rate limits, or what happens on errors. For a cloud API tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 sized and front-loaded: the first sentence states the purpose clearly, followed by structured Args and Returns sections. Every sentence earns its place, though the Returns section could be more detailed 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 (which covers return values), the description is moderately complete. It defines the purpose and parameter semantics adequately. However, for a cloud API tool with no annotations, it lacks behavioral context like authentication needs, error handling, or rate limits, which are important for an agent to use it correctly.

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: 'instance_id (str): EC2实例ID' clarifies it's an EC2 instance ID. With 0% schema description coverage (schema only has 'Instance Id' as title), this compensates well. However, it doesn't specify format constraints (e.g., AWS instance ID pattern like 'i-1234567890abcdef0').

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: '获取AWS EC2实例的存储详细信息' (Get AWS EC2 instance storage details). It specifies the verb ('获取' - get) and resource ('AWS EC2实例的存储详细信息' - AWS EC2 instance storage details), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_aws_instance_info', which might provide broader instance information.

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 sibling tools like 'get_aws_instance_info' or 'get_aws_instance_monitoring', nor does it specify use cases, prerequisites, or exclusions. The agent must infer usage from the name and description alone.

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