Skip to main content
Glama
aliyun

AlibabaCloud MCP Server

Official
by aliyun

RunCommand

Execute commands across multiple ECS instances simultaneously using AlibabaCloud MCP Server, ideal for managing applications, marking resources, and automating tasks efficiently.

Instructions

批量在多台ECS实例上运行云助手命令,适用于需要同时管理多台ECS实例的场景,如应用程序管理和资源标记操作等。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
CommandYesContent of the command executed on the ECS instance
CommandTypeNoThe type of command executed on the ECS instance, optional value:RunShellScript,RunPythonScript,RunPerlScript,RunBatScript,RunPowerShellScriptRunShellScript
InstanceIdsYesAlibabaCloud ECS instance ID List
RegionIdNoAlibabaCloud region IDcn-hangzhou

Implementation Reference

  • The handler function for the 'OOS_RunCommand' tool, which executes the specified command on multiple ECS instances using Alibaba Cloud's OOS service BulkyRunCommand template.
    @tools.append
    def OOS_RunCommand(
        Command: str = Field(description='Content of the command executed on the ECS instance'),
        InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'),
        RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'),
        CommandType: str = Field(description='The type of command executed on the ECS instance, optional value:RunShellScript,RunPythonScript,RunPerlScript,RunBatScript,RunPowerShellScript', default='RunShellScript')
    ):
        """批量在多台ECS实例上运行云助手命令,适用于需要同时管理多台ECS实例的场景,如应用程序管理和资源标记操作等。"""
        
        parameters = {
            'regionId': RegionId,
            'resourceType': 'ALIYUN::ECS::Instance',
            'targets': {
                'ResourceIds': InstanceIds,
                'RegionId': RegionId,
                'Type': 'ResourceIds',
                'Parameters': {
                    'RegionId': RegionId,
                    'Status': 'Running'
                }
            },
            "commandType": CommandType,
            "commandContent": Command
        }
        return _start_execution_sync(region_id=RegionId, template_name='ACS-ECS-BulkyRunCommand', parameters=parameters)
  • Helper function that starts an OOS execution with the given template and parameters, and synchronously polls until completion or failure.
    def _start_execution_sync(region_id: str, template_name: str, parameters: dict):
        client = create_client(region_id=region_id)
        start_execution_request = oos_20190601_models.StartExecutionRequest(
            region_id=region_id,
            template_name=template_name,
            parameters=json.dumps(parameters)
        )
        start_execution_resp = client.start_execution(start_execution_request)
        execution_id = start_execution_resp.body.execution.execution_id
    
        while True:
            list_executions_request = oos_20190601_models.ListExecutionsRequest(
                region_id=region_id,
                execution_id=execution_id
            )
            list_executions_resp = client.list_executions(list_executions_request)
            status = list_executions_resp.body.executions[0].status
            if status == FAILED:
                status_message = list_executions_resp.body.executions[0].status_message
                raise exception.OOSExecutionFailed(reason=status_message)
            elif status in END_STATUSES:
                return list_executions_resp.body
            time.sleep(1)
  • The registration code that adds all tools from oos_tools module (including OOS_RunCommand) to the FastMCP server instance.
    for tool in oos_tools.tools:
        mcp.tool(tool)
  • Pydantic Field definitions providing the input schema for the OOS_RunCommand tool.
    Command: str = Field(description='Content of the command executed on the ECS instance'),
    InstanceIds: List[str] = Field(description='AlibabaCloud ECS instance ID List'),
    RegionId: str = Field(description='AlibabaCloud region ID', default='cn-hangzhou'),
    CommandType: str = Field(description='The type of command executed on the ECS instance, optional value:RunShellScript,RunPythonScript,RunPerlScript,RunBatScript,RunPowerShellScript', default='RunShellScript')
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the tool runs commands on instances but doesn't describe critical behavioral aspects: what permissions are required, whether commands run synchronously or asynchronously, how results are returned, potential side effects, error handling, or rate limits. For a tool that executes commands on cloud instances (a potentially powerful/destructive operation), this is a significant gap in 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 - two sentences that convey the core purpose and usage context without unnecessary elaboration. It's front-loaded with the main functionality. While efficient, it could potentially benefit from slightly more structure (e.g., separating purpose from examples more clearly).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a command execution tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (success/failure indicators, command outputs, execution IDs), doesn't mention authentication requirements, doesn't warn about potential destructive commands, and doesn't provide error handling context. For a tool that could significantly impact cloud instances, more comprehensive guidance is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters thoroughly. The description doesn't add any parameter-specific information beyond what's in the schema (it doesn't explain Command syntax, InstanceIds format, or RegionId implications). According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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: '批量在多台ECS实例上运行云助手命令' (batch run cloud assistant commands on multiple ECS instances). It specifies the verb ('运行' - run) and resource ('ECS实例' - ECS instances), and mentions the multi-instance scope. However, it doesn't explicitly differentiate from potential sibling tools like 'RunInstances' (which likely provisions instances rather than running commands on existing ones).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides some usage context: '适用于需要同时管理多台ECS实例的场景,如应用程序管理和资源标记操作等' (suitable for scenarios requiring simultaneous management of multiple ECS instances, such as application management and resource tagging operations). This implies when to use it (batch management scenarios) but doesn't explicitly state when NOT to use it or name specific alternatives among the sibling tools. The guidance is helpful but not comprehensive.

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

Related 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/aliyun/alibaba-cloud-ops-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server