Manage Sessions
codex_sessionManage 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
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| sessionId | No | Required for get/cancel/interrupt/fork/clean_background_terminals | |
| includeSensitive | No | Include cwd/config/threadId/profile in get (default: false) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | ||
| error | No | ||
| model | No | ||
| config | No | ||
| status | No | ||
| isError | No | ||
| message | No | ||
| profile | No | ||
| sandbox | No | ||
| success | No | ||
| sessions | No | ||
| threadId | No | ||
| createdAt | No | ||
| sessionId | No | ||
| cancelledAt | No | ||
| lastActiveAt | No | ||
| pollInterval | No | Recommended minimum delay before next poll (ms): running >=120000, waiting_approval ~=1000. | |
| approvalPolicy | No | ||
| cancelledReason | No | ||
| pendingRequestCount | No |