Skip to main content
Glama

session_control

Destructive

Send input, interrupt, or EOF to an existing session, or stop its terminal. Check client_info.session_controls before interrupt or EOF. Avoid retrying input or signals when delivery is uncertain. After stop, use session_read to check for closed and drain output.

Input Schema

NameRequiredDescriptionDefault
inputNoRequired only for action=input; omit for other actions. Text is sent as provided without an added newline; include a newline to submit a shell command or prompt response.
actionYesOperation on this session: input sends stdin text (requires input); interrupt signals the foreground task; eof ends input according to platform semantics; stop cancels the entire session (optional wait_ms).
wait_msNoOnly for action=stop: maximum wait for a terminal result in milliseconds, 0–20000; default 1000. 0 returns a snapshot immediately. Omit for all other actions.
client_idNoDevice ID from list_client. Required with multi-device tokens for execute_command, session_read, session_control, and p2p_transfer_start.
session_idYesClient-local session identifier. Multi-device calls also require client_id.
control_tokenYesControl credential in token:key format, required with management access (including stdio and no-password mode). Scoped control bearer access implicitly selects its own token.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / client_id / description
      Previous value: -"Six lowercase letters or digits from list_client. Required for execute_command, session_read and session_control on multi-device tokens, including existing sessions. Session-list filtering is optional."New value: +"Device ID from list_client. Required with multi-device tokens for execute_command, session_read, session_control, and p2p_transfer_start."
  2. Changed3 schema fields changed
    • removedInput schema / properties / client_token
      Removed value: -{
      -  "description": "Control credential in token:key format, required with management access (including stdio and no-password mode). Scoped control bearer access implicitly selects its own token.",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • addedInput schema / properties / control_token
      Added value: +{
      +  "description": "Control credential in token:key format, required with management access (including stdio and no-password mode). Scoped control bearer access implicitly selects its own token.",
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "session_id",
      -  "action",
      -  "client_token"
      -]New value: +[
      +  "session_id",
      +  "action",
      +  "control_token"
      +]
  3. Changed4 schema fields changed
    • addedInput schema / properties / client_id
      Added value: +{
      +  "description": "Six lowercase letters or digits from list_client. Required for execute_command, session_read and session_control on multi-device tokens, including existing sessions. Session-list filtering is optional.",
      +  "pattern": "^[a-z0-9]{6}$",
      +  "type": "string"
      +}
    • changedInput schema / properties / client_token / description
      Previous value: -"Target client connection token, required with management access (including stdio and no-password mode). Device-scoped bearer access implicitly selects its own token."New value: +"Control credential in token:key format, required with management access (including stdio and no-password mode). Scoped control bearer access implicitly selects its own token."
    • changedInput schema / properties / session_id / description
      Previous value: -"Session identifier"New value: +"Client-local session identifier. Multi-device calls also require client_id."
    • changedOutput schema / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "ok": {
      -        "description": "The client acknowledged the operation request; does not prove the program consumed input or handled a signal.",
      -        "enum": [
      -          true
      -        ],
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "ok"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "error": {
      -        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      -        "type": "string"
      -      },
      -      "exit_code": {
      -        "description": "Exit code of the latest completed command, or terminal termination if it ended; 0 is success, -1 denotes execution/connection failure. Absent while a command is running.",
      -        "type": [
      -          "null",
      -          "integer"
      -        ]
      -      },
      -      "status": {
      -        "description": "running: stop is still pending; closed: session is no longer usable. Inspect error: disconnection does not confirm remote process termination.",
      -        "enum": [
      -          "running",
      -          "closed"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "status"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "ok": {
      +        "description": "The client acknowledged the operation request; does not prove the program consumed input or handled a signal.",
      +        "enum": [
      +          true
      +        ],
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "ok"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "error": {
      +        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      +        "type": "string"
      +      },
      +      "exit_code": {
      +        "description": "execute/read/list: the latest completed command exit code, preserved when its shell later ends. stop: the confirmed shell termination code. 0 means success; -1 denotes execution failure. Transport errors never invent a code.",
      +        "type": [
      +          "null",
      +          "integer"
      +        ]
      +      },
      +      "status": {
      +        "description": "running: stop is pending; closed: the client confirmed shell termination. A transport error does not confirm termination.",
      +        "enum": [
      +          "running",
      +          "closed"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "status"
      +    ],
      +    "type": "object"
      +  }
      +]
  4. Changed4 schema fields changed
    • addedInput schema / properties / session_id / maxLength
      Added value: +64
    • changedOutput schema / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "accepted": {
      -        "description": "Whether the action was sent to the device connection; this does not confirm it was consumed or completed.",
      -        "type": "boolean"
      -      },
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "input"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "accepted",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "interrupt"
      -        ],
      -        "type": "string"
      -      },
      -      "delivered": {
      -        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "delivered",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "eof"
      -        ],
      -        "type": "string"
      -      },
      -      "delivered": {
      -        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "delivered",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "accepted": {
      -        "description": "True if a cancellation request was sent or is pending. False for a session already ended before this call. This alone never confirms termination.",
      -        "type": "boolean"
      -      },
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "stop"
      -        ],
      -        "type": "string"
      -      },
      -      "already_done": {
      -        "description": "True if the session was already ended when this stop call began; no new cancellation request is sent.",
      -        "type": "boolean"
      -      },
      -      "canceled": {
      -        "description": "True only when the target reported cancellation; a disconnect alone does not confirm cancellation.",
      -        "type": [
      -          "null",
      -          "boolean"
      -        ]
      -      },
      -      "done": {
      -        "description": "True when a terminal result is available or the device connection closed; status and canceled identify the outcome.",
      -        "type": "boolean"
      -      },
      -      "error": {
      -        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      -        "type": "string"
      -      },
      -      "exit_code": {
      -        "description": "Reported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report.",
      -        "type": [
      -          "null",
      -          "integer"
      -        ]
      -      },
      -      "session_id": {
      -        "description": "Session identifier used by session_read and session_control.",
      -        "type": "string"
      -      },
      -      "status": {
      -        "description": "stopping: cancellation pending. stopped: terminal cancellation confirmed. finished: ended for another reason, including disconnection.",
      -        "enum": [
      -          "stopping",
      -          "stopped",
      -          "finished"
      -        ],
      -        "type": "string"
      -      },
      -      "timed_out": {
      -        "description": "True if the target reported that the process execution timeout elapsed.",
      -        "type": [
      -          "null",
      -          "boolean"
      -        ]
      -      }
      -    },
      -    "required": [
      -      "session_id",
      -      "accepted",
      -      "done",
      -      "status",
      -      "already_done",
      -      "action"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "ok": {
      +        "description": "The client acknowledged the operation request; does not prove the program consumed input or handled a signal.",
      +        "enum": [
      +          true
      +        ],
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "ok"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "error": {
      +        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      +        "type": "string"
      +      },
      +      "exit_code": {
      +        "description": "Exit code of the latest completed command, or terminal termination if it ended; 0 is success, -1 denotes execution/connection failure. Absent while a command is running.",
      +        "type": [
      +          "null",
      +          "integer"
      +        ]
      +      },
      +      "status": {
      +        "description": "running: stop is still pending; closed: session is no longer usable. Inspect error: disconnection does not confirm remote process termination.",
      +        "enum": [
      +          "running",
      +          "closed"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "status"
      +    ],
      +    "type": "object"
      +  }
      +]
    • removedOutput schema / properties
      Removed value: -{
      -  "action": {
      -    "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -    "enum": [
      -      "input",
      -      "interrupt",
      -      "eof",
      -      "stop"
      -    ],
      -    "type": "string"
      -  }
      -}
    • removedOutput schema / required
      Removed value: -[
      -  "action"
      -]
  5. Changed1 schema field changed
    • changedOutput schema / oneOf
      Previous value: -[
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "accepted": {
      -        "description": "Whether the action was sent to the device connection; this does not confirm it was consumed or completed.",
      -        "type": "boolean"
      -      },
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "input"
      -        ],
      -        "type": "string"
      -      }
      -    },
      -    "required": [
      -      "accepted",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "interrupt"
      -        ],
      -        "type": "string"
      -      },
      -      "delivered": {
      -        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "delivered",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "eof"
      -        ],
      -        "type": "string"
      -      },
      -      "delivered": {
      -        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      -        "type": "boolean"
      -      }
      -    },
      -    "required": [
      -      "delivered",
      -      "action"
      -    ],
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": false,
      -    "properties": {
      -      "accepted": {
      -        "description": "True if a cancellation request was sent or is pending. False for a session already ended before this call. This alone never confirms termination.",
      -        "type": "boolean"
      -      },
      -      "action": {
      -        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      -        "enum": [
      -          "stop"
      -        ],
      -        "type": "string"
      -      },
      -      "already_done": {
      -        "description": "True if the session was already ended when this stop call began; no new cancellation request is sent.",
      -        "type": "boolean"
      -      },
      -      "canceled": {
      -        "description": "True only when the target reported cancellation; a disconnect alone does not confirm cancellation.",
      -        "type": [
      -          "null",
      -          "boolean"
      -        ]
      -      },
      -      "done": {
      -        "description": "True when a terminal result is available or the device connection closed; status and canceled identify the outcome.",
      -        "type": "boolean"
      -      },
      -      "error": {
      -        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      -        "type": "string"
      -      },
      -      "exit_code": {
      -        "description": "Reported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report.",
      -        "type": [
      -          "null",
      -          "integer"
      -        ]
      -      },
      -      "next_action": {
      -        "description": "Next step to perform. Invitation creation returns the exact tool call and deadline; other tools return human-readable guidance.",
      -        "type": "string"
      -      },
      -      "session_id": {
      -        "description": "Session identifier used by session_read and session_control.",
      -        "type": "string"
      -      },
      -      "status": {
      -        "description": "stopping: cancellation pending. stopped: terminal cancellation confirmed. finished: ended for another reason, including disconnection.",
      -        "enum": [
      -          "stopping",
      -          "stopped",
      -          "finished"
      -        ],
      -        "type": "string"
      -      },
      -      "timed_out": {
      -        "description": "True if the target reported that the process execution timeout elapsed.",
      -        "type": [
      -          "null",
      -          "boolean"
      -        ]
      -      }
      -    },
      -    "required": [
      -      "session_id",
      -      "accepted",
      -      "done",
      -      "status",
      -      "already_done",
      -      "action"
      -    ],
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "accepted": {
      +        "description": "Whether the action was sent to the device connection; this does not confirm it was consumed or completed.",
      +        "type": "boolean"
      +      },
      +      "action": {
      +        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      +        "enum": [
      +          "input"
      +        ],
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "accepted",
      +      "action"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "action": {
      +        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      +        "enum": [
      +          "interrupt"
      +        ],
      +        "type": "string"
      +      },
      +      "delivered": {
      +        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "delivered",
      +      "action"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "action": {
      +        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      +        "enum": [
      +          "eof"
      +        ],
      +        "type": "string"
      +      },
      +      "delivered": {
      +        "description": "True only after the client confirms it performed the requested signal or EOF operation. Does not guarantee the program consumed it, stopped or exited.",
      +        "type": "boolean"
      +      }
      +    },
      +    "required": [
      +      "delivered",
      +      "action"
      +    ],
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": false,
      +    "properties": {
      +      "accepted": {
      +        "description": "True if a cancellation request was sent or is pending. False for a session already ended before this call. This alone never confirms termination.",
      +        "type": "boolean"
      +      },
      +      "action": {
      +        "description": "The session_control action this result describes; determines which acknowledgment or terminal fields apply.",
      +        "enum": [
      +          "stop"
      +        ],
      +        "type": "string"
      +      },
      +      "already_done": {
      +        "description": "True if the session was already ended when this stop call began; no new cancellation request is sent.",
      +        "type": "boolean"
      +      },
      +      "canceled": {
      +        "description": "True only when the target reported cancellation; a disconnect alone does not confirm cancellation.",
      +        "type": [
      +          "null",
      +          "boolean"
      +        ]
      +      },
      +      "done": {
      +        "description": "True when a terminal result is available or the device connection closed; status and canceled identify the outcome.",
      +        "type": "boolean"
      +      },
      +      "error": {
      +        "description": "Optional execution or connection error. A disconnect does not prove the remote process completed successfully.",
      +        "type": "string"
      +      },
      +      "exit_code": {
      +        "description": "Reported process exit code: 0 means success; -1 means execution failed, was interrupted, or the device disconnected before a normal exit report.",
      +        "type": [
      +          "null",
      +          "integer"
      +        ]
      +      },
      +      "session_id": {
      +        "description": "Session identifier used by session_read and session_control.",
      +        "type": "string"
      +      },
      +      "status": {
      +        "description": "stopping: cancellation pending. stopped: terminal cancellation confirmed. finished: ended for another reason, including disconnection.",
      +        "enum": [
      +          "stopping",
      +          "stopped",
      +          "finished"
      +        ],
      +        "type": "string"
      +      },
      +      "timed_out": {
      +        "description": "True if the target reported that the process execution timeout elapsed.",
      +        "type": [
      +          "null",
      +          "boolean"
      +        ]
      +      }
      +    },
      +    "required": [
      +      "session_id",
      +      "accepted",
      +      "done",
      +      "status",
      +      "already_done",
      +      "action"
      +    ],
      +    "type": "object"
      +  }
      +]
  6. Added

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true, openWorldHint=true, and idempotentHint=false, but the description adds the practical consequences: capability must be verified via session_controls before interrupt/EOF, and retrying input or signals under uncertain delivery is unsafe (reinforcing non-idempotency with an actionable rule). It does not explain what state a session is left in after interrupt or EOF differs from stop, which is the main remaining ambiguity for a destructive tool.

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?

Four short sentences, front-loaded with the action list, then prerequisites, then the anti-retry warning, then the follow-up. No sentence is filler and none repeats the schema verbatim.

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

Completeness4/5

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

An output schema exists so return values need not be described, and annotations carry the safety profile; the description nonetheless covers the prerequisite check, the retry hazard, and post-stop draining. What is missing is how eof differs from stop in session lifecycle terms, which matters given destructiveHint=true and four distinct actions.

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 the schema already documents input-requires-text-without-newline, wait_ms being stop-only with a 0–20000 range, and control_token format. The description only restates the action vocabulary at a high level, so the baseline of 3 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?

States a specific set of verbs (send input, interrupt, EOF, stop terminal) against a specific resource (an existing session), and explicitly scopes to *existing* sessions, which distinguishes it from session creation via execute_command. It also names session_read as the follow-up tool, so an agent can place it in a workflow without opening the schema.

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?

Gives real conditional guidance: check client_info.session_controls before interrupt or EOF, do not retry input or signals when delivery is uncertain, and use session_read after stop. It stops short of saying when to prefer input over execute_command or session_read for a given situation, so the alternatives are only partly routed.

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