Skip to main content
Glama

ssh_session_exec

Destructive

Execute a command in an existing SSH session, returning stdout, stderr, and exit code. Each command is policy-checked before execution; session state persists across commands.

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
decisionNopresent only on a dry_run: the policy decision (allow/deny/approval) with a machine-readable reason_code, instead of executed output
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?

With annotations indicating destructiveHint=true and readOnlyHint=false, the description adds substantial context beyond this: it clarifies exit_code semantics (remote failure vs tool error), policy preflight behavior, audit-mode warnings, and that session state persists. It also warns that later commands are rejected if policy changes after session open. This fully discloses behavioral traits without contradicting annotations.

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 and front-loaded: the first sentence states the core purpose and output. Subsequent sentences pack essential behavioral details without fluff. Every sentence provides unique value, making it appropriately sized for the complexity.

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

Completeness5/5

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

Given the tool's complexity (policy preflight, state persistence, exit code semantics) and the existence of an output schema, the description is remarkably complete. It covers the purpose, return values, error semantics, policy interactions, and state behavior, leaving no major gaps for an agent to infer.

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 100% (both parameters described: command and session_id). The description adds meaning by explaining that session_id comes from ssh_session_open, clarifying session state persistence, and mentioning mode implications. This goes beyond the schema descriptions, though not dramatically, so a 4 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 tool's function: 'Execute a command in a session opened with ssh_session_open.' This specific verb+resource combination distinguishes it from siblings like ssh_execute (standalone execution) and ssh_session_open (session creation). The name itself reinforces this purpose.

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 establishes clear usage context: it requires an existing session from ssh_session_open, implying it is not for standalone commands. It also mentions persistent session state for mode=shell or mode=pty, which helps differentiate from one-shot alternatives, though it does not explicitly name alternatives or state when not to use it.

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