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
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- src/orbstack_mcp/server.py:552-570 (handler)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()) - src/orbstack_mcp/server.py:542-551 (registration)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, }, ) - src/orbstack_mcp/server.py:124-140 (schema)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", )