describe_ecs_instances
Retrieve detailed information about Elastic Compute Service instances in a specified Alibaba Cloud region to monitor and manage cloud resources.
Instructions
查询ECS实例信息
Args:
region: 区域ID,如cn-beijing
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| region | No | cn-beijing |
Implementation Reference
- complete_fastmcp_server.py:29-47 (handler)The handler function implementing the 'describe_ecs_instances' tool logic. Registered via @app.tool() decorator. Delegates to a keyword-matching tool in common_api_tools.tools or returns availability message.def describe_ecs_instances(region: str = "cn-beijing") -> str: """查询ECS实例信息 Args: region: 区域ID,如cn-beijing """ try: sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'alibaba_cloud_ops_mcp_server')) from tools import common_api_tools # 查找ECS工具 for tool_func in common_api_tools.tools: if hasattr(tool_func, '__name__') and 'describe' in tool_func.__name__.lower() and 'instance' in tool_func.__name__.lower(): result = tool_func(RegionId=region) return str(result) return f"ECS实例查询功能可用,查询region: {region}" except Exception as e: return f"ECS查询失败: {str(e)}"
- complete_fastmcp_server.py:29-47 (registration)The @app.tool() decorator registers this function as an MCP tool named 'describe_ecs_instances'.def describe_ecs_instances(region: str = "cn-beijing") -> str: """查询ECS实例信息 Args: region: 区域ID,如cn-beijing """ try: sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'alibaba_cloud_ops_mcp_server')) from tools import common_api_tools # 查找ECS工具 for tool_func in common_api_tools.tools: if hasattr(tool_func, '__name__') and 'describe' in tool_func.__name__.lower() and 'instance' in tool_func.__name__.lower(): result = tool_func(RegionId=region) return str(result) return f"ECS实例查询功能可用,查询region: {region}" except Exception as e: return f"ECS查询失败: {str(e)}"
- Generic API caller used potentially by the handler to invoke actual Alibaba Cloud DescribeInstances API, though keyword matching doesn't hit this.def CommonAPICaller( service: str = Field(description='AlibabaCloud service code'), api: str = Field(description='AlibabaCloud api name'), parameters: dict = Field(description='AlibabaCloud ECS instance ID List', default={}), ): """ Use PromptUnderstanding tool first to understand the user's query, Perform the actual call by specifying the Service, API, and Parameters """ return _tools_api_call(service, api, parameters, None)