Skip to main content
Glama
atengk
by atengk

ssh_exec

Execute a single stateless Bash/Shell command on a remote Linux host and return its exit code, stdout, and stderr.

Instructions

在远程 Linux 主机执行单次无状态 Bash/Shell 命令,精准返回退出码、标准输出与标准错误

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdNo初始执行工作目录(自动包装为 cd <cwd> && <command>)
envNo注入远程环境的环境变量键值对
dryRunNo是否仅通过安全拦截守卫检测合规性,而不真正下发执行,默认 false
commandYes待在远程 Linux 系统执行的 Bash/Shell 命令
rawExecNo是否绕过登录 Shell 包装(bash -l -c),直接以非登录 Shell 原生执行,默认 false
timeoutMsNo执行超时时间(毫秒),默认 60000ms (1分钟)
connectionIdNo目标连接标识符,缺省时自动路由至当前默认活跃连接
dangerouslySkipSafetyCheckNo是否强制跳过前置高危安全拦截规则(危险操作逃生门,需同时配置环境变量 SSH_ALLOW_DANGEROUS_COMMANDS=true 授权)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.5

TDQS

A3.8/5.0
Behavior3/5

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

With no annotations at all, the description carries the full behavioral burden. It does disclose two important traits: the call is stateless and it returns exit code, stdout and stderr. It says nothing about the safety-interception guard (which can refuse or block a command), authentication requirements, or connection routing behavior — a notable gap for an execution tool with no annotation coverage.

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?

A single, tightly packed sentence with zero filler, front-loading the action, target and scope before the return contract. Nothing is redundant and nothing is buried.

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?

There is no output schema, and the description compensates by stating the return contract (exit code, stdout, stderr), which is exactly what an agent needs. The safety-guard and connection-routing behavior is largely covered by the parameter descriptions in the schema, but the absence of any annotation means some operational context (auth, blocking semantics) remains unstated.

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 all eight parameters (including cwd, env, dryRun, rawExec, timeoutMs, connectionId, dangerouslySkipSafetyCheck) are already documented in the schema. The description adds no parameter-level detail beyond what is structured, so the baseline of 3 applies.

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 names a specific verb+resource (execute a Bash/Shell command on a remote Linux host) and adds the scope qualifier '单次无状态' (single, stateless), which cleanly separates it from the stateful ssh_session_send/session tools. An agent can distinguish it from every sftp_* and ssh_session_* sibling without opening a schema.

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 phrase '单次无状态' implies when this tool is appropriate (one-shot commands, no persistent shell state), which is useful context. However, it never names an alternative or an exclusion condition, so the agent must infer that ssh_session_start/send exists for multi-step stateful work.

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