Skip to main content
Glama

ssh_session_exec

Execute a command in an open SSH session, returning stdout, stderr, and exit code.

Instructions

Execute a command in a session opened with ssh_session_open. Returns stdout, stderr and exit_code. exit_code != 0 means remote command failure, NOT a tool error. The command is preflighted against the current signer policy before execution; target and bastion access, end-user groups, sudo, sudo_user, PTY, and the host's physical route are revalidated, and audit-mode policy warnings are returned in warnings. If a policy is enabled after a shell/pty session was opened, later commands in that session are rejected. Session state (current directory, environment variables) persists across calls when mode=shell or mode=pty.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYescommand to execute in the session
session_idYesid returned by ssh_session_open

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
serialYesaudit identifier; ignore when reasoning about the result
stderrYeserror output of the remote command (empty when pty=true, since stdout and stderr are merged)
stdoutYesstandard output of the remote command
warningsNoadvisory warnings; command_policy audit-mode warnings mean the command was allowed but would have been blocked or approval-gated in enforce mode
exit_codeYesexit code of the remote command: 0=success, non-zero=command failure (NOT a tool error)
Behavior5/5

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

Despite no annotations, the description thoroughly discloses behaviors: preflighting against signer policy, revalidation of access and session settings, audit-mode warnings, policy changes causing rejection, and state persistence. This fully informs the agent of important operational traits.

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?

The description is concise with 5 sentences, each adding essential information. It is front-loaded with the core action and returns, followed by critical behavioral details. No unnecessary words.

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 presence of an output schema (assumed to detail return values), the description adequately covers purpose, return semantics, preflighting, policy, and state persistence. It lacks explicit mention of session validity or error handling, but overall is sufficiently complete for a session-based command execution tool.

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?

Both parameters are described in the schema (100% coverage). The description adds no additional parameter-specific meaning beyond behavioral context, which is not directly about parameter meaning. Baseline 3 is appropriate.

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 clearly states the action: 'Execute a command in a session opened with ssh_session_open.' It distinguishes from sibling tools like ssh_execute by specifying session context. The returns (stdout, stderr, exit_code) are mentioned, making the tool's purpose unambiguous.

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

Usage Guidelines4/5

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

The description provides useful context on when to use this tool: when a session is open. It explains exit_code semantics and preflighting. However, it does not explicitly guide against using it when a one-off command is needed via ssh_execute, missing a clear when-not-to-use reference.

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/luisgf/infrabroker'

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