Skip to main content
Glama

instance_exec

Runs shell commands over SSH as root inside a GPU instance, returning exit codes and output; supports background execution for long training jobs with log and status tracking.

Instructions

在实例内执行 shell 命令(SSH,root)。部署/操作/训练的核心工具。

  • 前台:返回 exit_code/stdout/stderr;timeout_sec 上限 600s。

  • background=true:setsid 脱离会话后台运行(训练等长任务),立即返回 pid/log_file/exit_file;用 instance_job(action=status/logs/stop) 跟进。

  • workdir:先 cd 到该目录(持久数据在 /workspace)。 示例:rocm-smi;pip install -r requirements.txt; background 训练:python train.py --epochs 10。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "command": "<command>"
    },
    "name": "instance_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandYes
workdirNo
log_fileNo
backgroundNo
timeout_secNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the full burden and discloses a lot: root over SSH, foreground returns exit_code/stdout/stderr, a 600s timeout ceiling, and background detaches via setsid returning pid/log_file/exit_file. It does not say what happens to a running command when the timeout is hit or describe permission/credential requirements, leaving some behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose, then bulleted by mode (foreground, background, workdir), followed by short examples. Dense and well organized with no wasted sentences.

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?

For a root shell execution tool with no output schema, this is nearly complete: modes, limits, return fields, and follow-up tool are all covered. The main omissions are timeout-kill behavior and the exact meaning of the log_file input.

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 coverage is 0%, so the description must compensate, and it does explain command, workdir, background, and timeout_sec well. The log_file input parameter is only mentioned as a returned artifact, not as an input to configure, leaving that one ambiguous.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource (execute shell commands in the instance over SSH as root) and frames its role as the core deployment/operation/training tool. It is clearly distinguishable from instance_job, which it names as the follow-up tool.

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

Usage Guidelines5/5

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

It explicitly says when to use foreground versus background=true, names instance_job(action=status/logs/stop) as the tool for monitoring long tasks, specifies max timeout, and provides concrete examples (rocm-smi, pip install, background training).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.