Skip to main content
Glama
heresun

OrbStack MCP Server

by heresun

orbstack_machine_run

Execute commands on Linux machines within OrbStack, specifying target machines and users to run system operations and retrieve output.

Instructions

在 Linux 机器中执行命令并返回输出。

可以指定目标机器和执行用户。不指定机器时使用默认机器。

Args: params: 包含要执行的命令、可选的机器名和用户

Returns: str: 命令执行输出

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the `orbstack_machine_run` tool, which constructs the command arguments and executes them.
    async def orbstack_machine_run(params: MachineRunInput) -> str:
        """在 Linux 机器中执行命令并返回输出。
    
        可以指定目标机器和执行用户。不指定机器时使用默认机器。
    
        Args:
            params: 包含要执行的命令、可选的机器名和用户
    
        Returns:
            str: 命令执行输出
        """
        args = []
        if params.machine:
            args.extend(["-m", params.machine])
        if params.user:
            args.extend(["-u", params.user])
    
        # orb 命令直接接受要运行的命令
        args.extend(["run", "--"] + params.command.split())
  • MCP tool registration for `orbstack_machine_run` using the `@mcp.tool` decorator.
    @mcp.tool(
        name="orbstack_machine_run",
        annotations={
            "title": "在 Linux 机器中执行命令",
            "readOnlyHint": False,
            "destructiveHint": False,
            "idempotentHint": False,
            "openWorldHint": False,
        },
    )
  • Pydantic model defining the input parameters for `orbstack_machine_run`.
    class MachineRunInput(BaseModel):
        """在 Linux 机器中执行命令的输入参数"""
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
    
        command: str = Field(
            ...,
            description="要执行的命令,如 'uname -a', 'ls -la /home' 等",
            min_length=1,
        )
        machine: Optional[str] = Field(
            default=None,
            description="目标机器名称,不指定则使用默认机器",
        )
        user: Optional[str] = Field(
            default=None,
            description="执行命令的用户,如 root",
        )
Behavior3/5

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

Annotations indicate readOnlyHint=false, destructiveHint=false, idempotentHint=false, and openWorldHint=false, which already tells the agent this is a non-destructive, non-idempotent operation with specific parameters. The description adds that it executes commands and returns output, which is consistent with annotations. It doesn't provide additional behavioral context like execution time limits, error handling, or authentication requirements beyond what annotations imply.

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 well-structured and concise: it starts with the core purpose, then explains parameter usage, and ends with return value. Each sentence adds value without redundancy. However, the Chinese formatting with line breaks slightly affects readability, and it could be more front-loaded with key information.

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

Completeness4/5

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

Given the tool's complexity (command execution with optional targeting), the description covers the essential aspects: what it does, parameter semantics, and return type. With annotations providing safety hints and an output schema indicating a string return, the description doesn't need to explain return values in detail. It adequately complements the structured data for this type of tool.

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?

Schema description coverage is 0%, meaning the schema provides no parameter descriptions. The description compensates by explaining the 'params' object contains the command, optional machine name, and user, and clarifies default behavior when machine isn't specified. It adds meaningful context beyond the bare schema, though it could provide more detail on parameter formats or constraints.

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: '在 Linux 机器中执行命令并返回输出' (execute commands in Linux machines and return output). It specifies the verb ('执行命令' - execute commands) and resource ('Linux 机器' - Linux machines). However, it doesn't explicitly differentiate from sibling tools like 'orbstack_docker_exec' or 'orbstack_machine_info', which reduces it from a perfect score.

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: '可以指定目标机器和执行用户。不指定机器时使用默认机器' (can specify target machine and execution user; uses default machine if not specified). This gives basic guidance on when to use optional parameters. However, it doesn't explain when to choose this tool over alternatives like 'orbstack_docker_exec' or other execution tools, nor does it mention prerequisites or exclusions.

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/heresun/orbstack-mcp'

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