Skip to main content
Glama

Manage Sessions

codex_session
Destructive

Manage coding-agent sessions by listing or inspecting them, canceling or interrupting work, forking threads, and cleaning stale background terminals.

Instructions

Session actions: list, get, cancel, interrupt, fork, clean_background_terminals.

  • list: sessions in memory.

  • get: details. includeSensitive defaults to false; true adds threadId/cwd/profile/config.

  • cancel: terminal.

  • interrupt: stop current turn.

  • fork: clone current thread into a new session; source remains unchanged.

  • clean_background_terminals: ask app-server to clean stale background terminals for this thread.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "action": "<action>"
    },
    "name": "codex_session"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYes
sessionIdNoRequired for get/cancel/interrupt/fork/clean_background_terminals
includeSensitiveNoInclude cwd/config/threadId/profile in get (default: false)

Output Schema

NameRequiredDescriptionDefault
cwdNo
errorNo
modelNo
configNo
statusNo
isErrorNo
messageNo
profileNo
sandboxNo
successNo
sessionsNo
threadIdNo
createdAtNo
sessionIdNo
cancelledAtNo
lastActiveAtNo
pollIntervalNoRecommended minimum delay before next poll (ms): running >=120000, waiting_approval ~=1000.
approvalPolicyNo
cancelledReasonNo
pendingRequestCountNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.1.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare destructiveHint=true and readOnlyHint=false, and the description does not contradict them. It adds some genuinely useful behavior: fork leaves the source unchanged, clean_background_terminals cleans stale terminals for this thread, and includeSensitive defaults to false. What it omits is a per-action safety breakdown — an agent cannot tell which of list/get/cancel/fork are destructive, so the tool-level destructiveHint shadows the read-only actions.

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-loaded action list with one bullet per option and virtually no filler; every line maps to an enum value. A few bullets are so compressed they lose meaning ('cancel: terminal.'), which is under-specification rather than verbosity.

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

Completeness3/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. But for a destructive, six-action tool with a required sessionId, the definition still leaves open what 'cancel' does to a session versus 'interrupt', and whether cleaned terminals or forked sessions persist. Adequate, not complete.

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 67%, and the schema already states that sessionId is required for get/cancel/interrupt/fork/clean_background_terminals and that includeSensitive adds cwd/config/threadId/profile to get. The description largely restates those, though it does add value by giving meaning to the raw action enum values. No extra detail on sessionId format or thread identity is provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names the resource (sessions) and enumerates six distinct verbs, each with a one-line gloss, so an agent can tell 'fork' from 'interrupt' without opening the schema. It does not explicitly differentiate the tool from siblings like codex_reply, and terse glosses such as 'cancel: terminal' and 'list: sessions in memory' leave a little ambiguity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

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

Enumerating actions implies when each one applies, and 'fork: clone current thread into a new session; source remains unchanged' gives a real selection hint versus starting fresh. However, there is no guidance about when to use this tool instead of codex/codex_reply, no prerequisites (e.g. an existing sessionId/thread), and no statement of which actions are safe to call repeatedly.

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

Deploy Server

Other Tools