Skip to main content
Glama

execute

Destructive

Run shell commands locally or over SSH with configurable timeouts. Returns output and exit code for completed commands or partial output for silent periods.

Instructions

Execute a command locally or over SSH in an isolated channel.

PARAMETER RELATIONSHIPS & VALIDATION:
- `session_id` vs `shell`: `session_id` determines the execution environment. If provided (must be a valid active session), it runs over SSH and `shell` is completely ignored. If omitted, it runs locally, and `shell` (e.g., 'powershell.exe', '/bin/bash') is used.
- `pause_timeout` vs `total_timeout`: These interact to manage execution time. `pause_timeout` (must be > 0) triggers an early return if the command goes silent for that many seconds. `total_timeout` (must be >= `pause_timeout`) sets a hard wall-clock limit even if output is constantly streaming. To wait longer for a quiet command (e.g., a build), increase `pause_timeout`.
- Both timeouts accept floats but invalid ranges (e.g., pause_timeout <= 0, or total_timeout < pause_timeout) or an unknown `session_id` will raise a ValueError.

WHEN NOT TO USE: 
Do not use this to send input to an existing command (`respond`), send control keys (`send_control`), or poll a running command (`read_output`).

SIDE EFFECTS: 
Spawns a new, stateless process. `cd` or environment variables do NOT persist between calls. For persistent state, start a terminal multiplexer in the foreground. Never use `&` to background TUI apps.

RETURNS:
- {"status": "completed", "output": str, "exit_code": int}
- {"status": "partial", "output": str, "command_id": str}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shellNoShell for local execution (e.g. 'powershell.exe', '/bin/bash'); ignored for SSH
commandYesShell command to run (stateless — cd does not persist between calls)
session_idNoSSH session_id from connect_ssh; omit for local execution
pause_timeoutNoSeconds of silence before returning a partial result (> 0, ≤ total_timeout)
total_timeoutNoHard cap on call duration in seconds (≥ pause_timeout)
Behavior5/5

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

Discloses statelessness, non-persistence of cd/env, and warnings about backgrounding. Annotations provide destructiveHint and readOnlyHint, and description adds context beyond 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?

Well-structured with clear sections: purpose, parameter relationships, when not to use, side effects, returns. Every sentence adds value; no fluff.

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?

Covers all aspects: purpose, usage guidance, behavioral traits, parameter details, return types. No gaps given the tool's complexity and absence of output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and description adds significant extra semantics: parameter relationships (session_id vs shell, pause_timeout vs total_timeout), validation (ValueError on invalid ranges), and defaults.

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?

Clear verb+resource+context: 'Execute a command locally or over SSH in an isolated channel.' Distinguishes from sibling tools like respond, send_control, read_output.

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?

Explicit 'WHEN NOT TO USE' section listing alternatives. Also explains parameter relationships and validation, guiding when to use local vs SSH.

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/QiuwenZheng/interminal'

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