Skip to main content
Glama

ssh_exec

Runs shell commands in a persistent SSH session and returns JSON output, exit code, and current directory, enabling multi-step Linux administration across calls.

Instructions

在已打开的会话里执行一条 shell 命令并返回输出、退出码和当前目录。持久会话:cd/export 会保留到下一次调用。返回 JSON。

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": "ssh_exec"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNo模式3 下强制执行高危命令
commandYes要执行的命令,可包含管道、重定向、heredoc
sessionNo会话名;只有一个会话时可省略
timeoutNo超时秒数,默认 30
max_outputNo最大输出字节数,默认 262144

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.7/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose two important traits: statefulness across calls and the shape of the result (output + exit code + cwd, JSON). It does not warn that this is an arbitrary-command execution surface, does not explain the high-risk/'模式3' gating that the schema's force parameter references, and says nothing about permission or timeout semantics.

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?

Three short sentences ordered by importance: what it does, the persistence caveat that most affects usage, and the return format. No filler.

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

Completeness3/5

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

For a command-execution tool with no annotations and no output schema, the description covers the essentials (statefulness, return fields). It leaves notable gaps: risk/permission implications of running arbitrary commands and the meaning of the force gate that the schema references without definition.

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 five parameters are already documented, including defaults for timeout and max_output. The description adds no parameter-level meaning of its own — notably, 'force' and the undefined '模式3' concept are left entirely to the schema.

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?

States a specific verb and resource (execute a shell command) scoped to an already-opened session, and names the return payload (output, exit code, cwd). The phrase '在已打开的会话里' implicitly distinguishes it from ssh_open, which establishes the session.

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 prerequisite that a session must already exist is implied, and the persistence note tells the agent that cd/export carry over, which shapes how it should batch commands. However, there is no explicit when-not guidance, no mention of what to do without an open session, and no routing to ssh_list/ssh_status alternatives.

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