Skip to main content
Glama

shell_session

Run shell commands in a background process for installs, scripts, and file operations. Executes commands to completion and returns exit codes.

Instructions

Purpose: Reliable background shell channel backed by a real OS process (stdin/stdout/stderr + exit code). Use this for installs, scripts, file ops, and any command that must actually finish — not the visible-terminal terminal tool. Details: Actions: start (spawn hidden shell), write (stdin + optional wait/read), read (drain ring buffer), exec (one-shot run-to-completion with exit code), list, stop. Never reports ok:true on write unless stdin accepted AND process still tracked; exec only returns ok:true when exitCode===0. Non-zero exits return ok:false code:ShellSessionNonZeroExit with stdout/stderr. Default shell: powershell on Windows, bash elsewhere. Independent of GUI focus, IME, clipboard, and SoM terminal pollution. Prefer: Prefer shell_session({action:'exec', input:'...'}) for one-shot commands. Prefer start+write+read for interactive multi-step shells. Keep terminal for when you must drive a visible console window the user is watching. Caveats: This does NOT open a visible window — do not use it when the user needs to see the console UI. Ring buffer is capped (default 1MB). Max 16 concurrent sessions. On Windows, powershell/cmd are windowsHide; do not send Ctrl+C via keyboard tools into these sessions (use action:'stop'). Examples: shell_session({action:'exec', input:'whoami'}) → {ok:true, exitCode:0, stdout:'...'} shell_session({action:'start', id:'ops', shell:'powershell'}) → {ok:true, session:{pid,...}} shell_session({action:'write', id:'ops', input:'Get-ChildItem', waitMs:500}) → stdout/stderr shell_session({action:'read', id:'ops', clear:true}) shell_session({action:'stop', id:'ops'})

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior5/5

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

Despite no annotations, the description thoroughly discloses behavior: actions list, exit code handling (ok:false with specific error code for non-zero), ring buffer cap (1MB), concurrency limit (16 sessions), Windows powershell hidden nature, and that it does not open a visible window. No contradictions.

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?

The description is well-structured with sections (Purpose, Actions, Details, Prefer, Caveats, Examples) and front-loaded with essential distinctions. It is longer than minimal but each sentence adds value given the complexity and missing schema. Not excessively verbose.

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?

For a tool with no output schema and no annotations, the description is remarkably complete: covers all actions, error handling, limits, platform specifics, and provides multiple examples. Agent can correctly invoke and interpret results based on this description alone.

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?

The input schema has no parameters, but the description fully compensates by detailing each action's parameters (action, id, input, waitMs, shell, clear) with examples for exec, start, write, read, stop. Schema coverage is effectively 100% due to description.

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 it is a 'reliable background shell channel backed by a real OS process' and instructs to use it for 'installs, scripts, file ops, and any command that must actually finish'. It explicitly distinguishes from the sibling 'terminal' tool, making the purpose and scope unambiguous.

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?

Provides explicit guidance: prefer 'exec' for one-shot, 'start+write+read' for interactive sessions, and to use 'terminal' only when a visible console is needed. Also includes caveats about not using when the user needs to see the UI, with concrete alternatives.

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/wangkang1133/desktop-touch-mcp'

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