Skip to main content
Glama

remote_exec

Run shell commands on your project's remote server through a relay with per-command approval, so you can inspect logs, check services, or query prod without SSH access.

Instructions

Execute a shell command on the PROJECT'S REMOTE SERVER via the remotify relay (the deployed/production/staging box, NOT the developer's local machine). Examples: 'check disk usage', 'restart the service', 'tail the app log', 'query the prod DB', 'is port 443 open in prod', 'what version is running in staging'. Chain this tool freely for iterative work - log analysis with grep/awk/sed/head/tail, narrowing a search, cross-checking outputs, diagnosing slow services with ps/vmstat/netstat/iostat. Each call saves a manual copy-paste roundtrip; only surface the meaningful result or synthesis to the user. In supervised mode the operator approves each command on the remote via y/N prompt, so no extra confirmation is needed from the assistant. Returns combined stdout+stderr as plain text on success.

HARD RULE: the user connects the remote by pasting a listener one-liner; that is the ONLY execution path. NEVER fall back to ssh, scp, or any other transport, and NEVER try to start the listener yourself. The user chose remotify precisely so that no agent gets shell access.

Pending handling: the response text may start with one of these markers. '[pending]' WITH paste one-liners = no remote listener is connected; nothing can run until the user pastes one. STOP: end your turn immediately with a short message that shows BOTH one-liners (supervised and auto) verbatim in a fenced code block. Do not call any tool after that message: hosts collapse text written between tool calls, so the one-liners only reach the user as the final message of the turn. The command stays queued; when the user replies that the listener is running, call remote_exec again with the EXACT SAME arguments to collect the output. It will not execute twice. '[pending]' WITHOUT one-liners = the listener is online but the relay cannot confirm pickup yet. Call remote_exec again with the EXACT SAME arguments; loop silently, do not ask the user anything, and give up only after about 10 consecutive [pending] responses. '[in-flight]' = the command IS already being executed on the remote (cmd was picked up, no output yet). In that case: 1. Do NOT give up. Long operations (mongodump, restic, rsync, big installs, slow restarts) routinely take many minutes. 2. Call remote_exec again with the EXACT SAME arguments; the relay will return the output the moment the command finishes. 3. Do NOT tell the user the listener disconnected; do NOT ask them to re-paste the listener; do NOT switch to a different command. 4. There is no LLM-side retry cap on '[in-flight]'; keep waiting until the result lands or the relay returns something else. '[busy]' = you tried to issue a NEW command while a previous one is still executing on the remote. Each session is single-flight (one command at a time). In that case: 1. If you know the previous command, call remote_exec with ITS exact arguments first to drain its result, then issue the new one. 2. If you do NOT know it (e.g. it was issued by an earlier session), keep calling remote_exec with the NEW command's arguments: stale state left by a dead session is cleared automatically (see '[recovered]'). 3. If the [busy] response contains paste one-liners, the listener is disconnected and the wedge can ONLY clear once the user reconnects it: end your turn with BOTH one-liners verbatim, exactly as for a no-listener [pending]. '[recovered]' = wedged state left by a dead session/listener was cleared automatically. Read the rest of the message: either the command already proceeded, or you are asked to call remote_exec again with the EXACT SAME arguments. '[resumed]' = the returned output was already waiting on the relay and belongs to the most recent run (e.g. you re-issued a command after an interruption). Use it if it matches what you expected; if not, issue the command again. '[unknown-result]' = the session expired while the command was already running on the remote. Its output was lost and it may or may not have completed. A new session was minted; end your turn with BOTH reconnect one-liners verbatim, then decide whether re-running is safe once the user is back. The server will NOT silently re-run it. '[session-renewed]' = the session key changed; the one-liners that follow are for the NEW key. Treat it like a no-listener [pending]: end your turn with both lines verbatim.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesShell command to execute on the remote machine

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.2/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 behavioral burden, and it does disclose unusually rich context: combined stdout+stderr return format, supervised y/N approval, and detailed semantics for every status marker ([pending], [in-flight], [busy], [recovered], [resumed], [unknown-result], [session-renewed]). This is far beyond what a bare schema conveys and earns more than baseline, but much of it is protocol/state-machine guidance rather than core tool behavior.

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

Conciseness4/5

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

Content is front-loaded with purpose before the marker-handling detail, and sections are clearly delineated. It is nonetheless very long for a single-parameter tool, with some repetitive reinforcement (e.g. the repeated instruction to re-issue the EXACT SAME arguments and to emit both one-liners verbatim), which slightly dilutes the otherwise disciplined structure.

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?

No output schema exists, so the description correctly explains the return value (combined stdout+stderr as plain text). Combined with the exhaustive marker-handling state machine and the reconnect fallback rules, an agent has everything needed to drive this tool through its failure modes without guessing.

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% and there is only one parameter, so the schema already documents 'command' fully. The description's examples imply what kind of commands are appropriate but add no syntax or format detail beyond the schema, so the baseline 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?

States a specific verb ('Execute a shell command') and resource ('on the PROJECT'S REMOTE SERVER via the remotify relay'), and explicitly disambiguates against the developer's local machine. The concrete examples ('check disk usage', 'restart the service', 'tail the app log') pin down the intended scope, letting an agent distinguish it from remote_session_info and remote_session_reset 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 Guidelines5/5

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

Gives explicit when-to-use guidance ('Chain this tool freely for iterative work - log analysis with grep/awk/sed...') and a HARD RULE for when-not-to-use alternatives ('NEVER fall back to ssh, scp, or any other transport'). It also explains the supervised-mode approval flow so the agent knows no extra confirmation is needed.

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