Skip to main content
Glama

session_start

Destructive

Start an interactive or long-running process in a fresh shell on the selected device and return session_id before completion. This does not automatically create a persistent shell: a one-shot command ends its session when it exits. To preserve working directory, variables, functions or an activated environment across commands, explicitly launch a shell that keeps reading stdin (for example, bash -i on Linux/macOS where available), then send subsequent commands through session_control(action=input) using the same session_id. Repeated session_start calls create independent processes. The interpreter is reported by list_clients as client_info.shell; choose a command suitable for the target platform. Linux/macOS use a PTY; Windows uses pipes without terminal emulation. Use session_read for output and session_control(action=stop) for cancellation. Shell state lasts only while that shell is alive; client disconnection terminates sessions and reconnect does not restore them. Each token retains up to six sessions. Finished records may expire after 30 minutes or be evicted when later sessions start.

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking directory for this process on the target device.
envNoEnvironment overrides for this command, merged with the client environment. Values must be strings.
commandYesShell command to execute on the target device.
client_idNoSix lowercase letters or digits from list_clients. Required for multi-device tokens, even when only one device is online; optional for single-device tokens.
timeout_msNoProcess execution timeout in milliseconds. 0 disables the timeout.
client_tokenYesTarget client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token.

Output Schema

NameRequiredDescriptionDefault
cursorYesInitial output byte cursor, always 0 for a new session.
session_idYesSession identifier used by session_read and session_control.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / session_id / description
      Previous value: -"Session identifier used by session_read, session_write and session_stop."New value: +"Session identifier used by session_read and session_control."
  2. Changed7 schema fields changed
    • changedInput schema / properties / client_token / description
      Previous value: -"Target client connection token (required when authenticated with the management key)"New value: +"Target client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token."
    • changedInput schema / properties / command / description
      Previous value: -"Shell command"New value: +"Shell command to execute on the target device."
    • changedInput schema / properties / cwd / description
      Previous value: -"Working directory on the target device. Each command starts a fresh shell; use cwd for subsequent commands instead of relying on a previous cd."New value: +"Working directory for this process on the target device."
    • changedInput schema / properties / timeout_ms / description
      Previous value: -"Execution timeout in milliseconds, up to 86400000 (24 hours). 0 disables the timeout. Default: 60000 for execute_command, 0 for session_start."New value: +"Process execution timeout in milliseconds. 0 disables the timeout."
    • changedOutput schema / additionalProperties
      Previous value: -trueNew value: +false
    • addedOutput schema / properties
      Added value: +{
      +  "cursor": {
      +    "description": "Initial output byte cursor, always 0 for a new session.",
      +    "type": "integer"
      +  },
      +  "session_id": {
      +    "description": "Session identifier used by session_read, session_write and session_stop.",
      +    "type": "string"
      +  }
      +}
    • addedOutput schema / required
      Added value: +[
      +  "session_id",
      +  "cursor"
      +]
  3. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Goes well beyond the destructive/openWorld annotations: PTY on Linux/macOS vs pipes without terminal emulation on Windows, client disconnection terminates sessions and reconnect does not restore them, shell state lifetime, a six-session-per-token cap, and 30-minute expiry/eviction. These are non-obvious operational constraints an agent could not infer elsewhere.

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?

Front-loads purpose and the return value, then layers constraints in a logical order. It is dense and long, but nearly every sentence carries distinct behavioral information; a tighter grouping of the lifetime/expiry clauses would help slightly.

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 session-spawning mutation tool with an output schema, the description covers spawning semantics, persistence caveats, platform differences, lifecycle limits, and the follow-up tools. Nothing an agent needs to invoke it correctly is missing.

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 coverage is 100%, so parameters are already documented and the baseline is 3. The description adds platform-selection context ('interpreter is reported by list_clients as client_info.shell; choose a command suitable for the target platform') but says nothing extra about cwd, env, timeout_ms, or client_id semantics.

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 and resource ('Start an interactive or long-running process in a fresh shell') and immediately clarifies the return (session_id). The 'fresh shell' and one-shot-exit language distinguishes it from execute_command and from session_control.

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?

Explicitly says what it does NOT do (no automatic persistent shell) and gives the exact alternative pattern (launch bash -i, then session_control(action=input) with the same session_id). Also routes output reading to session_read and cancellation to session_control(action=stop), and notes repeated calls create independent processes.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources