Skip to main content
Glama
rainhan99

Cloud Manage MCP Server

by rainhan99

list_aws_instances

Retrieve a list of all AWS EC2 instances to monitor and manage resources effectively using the Cloud Manage MCP Server. Simplify instance tracking and operations.

Instructions

列出所有AWS EC2实例 Returns: Dict: AWS实例列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:368-376 (handler)
    MCP tool registration and handler for 'list_aws_instances'. This function is decorated with @mcp.tool() which registers it as an MCP tool and delegates the implementation to aws_provider.list_instances().
    @mcp.tool() def list_aws_instances() -> Dict: """ 列出所有AWS EC2实例 Returns: Dict: AWS实例列表 """ return aws_provider.list_instances()
  • The core helper function list_instances() in AWSProvider class that implements the logic to list all EC2 instances using boto3, handling errors and formatting the response.
    def list_instances(self) -> Dict: """ 列出所有EC2实例 Returns: Dict: 实例列表或错误信息 """ if not self.available: return { 'error': f'AWS服务不可用: {getattr(self, "error", "未知错误")}', 'provider': 'aws' } try: response = self.ec2.describe_instances() instances = [] for reservation in response['Reservations']: for instance in reservation['Instances']: instance_info = self._format_instance_summary(instance) instances.append(instance_info) return { 'provider': 'aws', 'region': self.region, 'total_instances': len(instances), 'instances': instances } except ClientError as e: return { 'error': f'AWS API调用失败: {str(e)}', 'provider': 'aws' } except Exception as e: return { 'error': f'列出EC2实例时发生错误: {str(e)}', 'provider': 'aws' }

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