Skip to main content
Glama

Cloud Manage MCP Server

by rainhan99

get_aws_instance_storage_info

Retrieve detailed storage information for an AWS EC2 instance, including disk type, IOPS, and throughput, using the instance ID as input.

Instructions

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

Input Schema

NameRequiredDescriptionDefault
instance_idYes

Input Schema (JSON Schema)

{ "properties": { "instance_id": { "title": "Instance Id", "type": "string" } }, "required": [ "instance_id" ], "title": "get_aws_instance_storage_infoArguments", "type": "object" }

Implementation Reference

  • main.py:341-352 (handler)
    MCP tool handler and registration for get_aws_instance_storage_info. Thin wrapper delegating to aws_provider.
    @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)
  • Actual implementation of AWS storage info retrieval using boto3 EC2 and Volumes APIs. Fetches block devices, volumes, and details like 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:12-13 (registration)
    Import of aws_provider module used by the tool handler.
    from providers.aws_provider import aws_provider from providers.digitalocean_provider import digitalocean_provider

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