MCP server tools - sessionId

Resolved 💬 3 comments Opened Aug 8, 2025 by chew-z Closed Oct 27, 2025
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.19.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

Calling codex tool and next calling codex-replay.

Call to codex does not explicte return sessionId that is required to continue conversation using codex-replay tool.

{
  "method": "tools/call",
  "params": {
    "name": "codex",
    "arguments": {
      "config": {},
      "prompt": "Please add 2 + 2"
    },
    "_meta": {
      "progressToken": 0
    }
  }
}
{
  "content": [
    {
      "type": "text",
      "text": "4"
    }
  ]
}

sessionId is returned in initial events but never explicite.

{
  "jsonrpc": "2.0",
  "method": "session_configured",
  "params": {
    "_meta": {
      "requestId": 2
    },
    "id": "0",
    "msg": {
      "type": "session_configured",
      "session_id": "bf6f1890-74d7-42c1-801d-12de30a0c560",
      "model": "gpt-5",
      "history_log_id": 11897878,
      "history_entry_count": 4
    }
  }
}

And this sessionId is required to properly call codex-replay

{
  "method": "tools/call",
  "params": {
    "name": "codex-reply",
    "arguments": {
      "prompt": "Increase previous result by 10",
      "sessionId": "bf6f1890-74d7-42c1-801d-12de30a0c560"
    },
    "_meta": {
      "progressToken": 1
    }
  }
}

{
  "content": [
    {
      "type": "text",
      "text": "14"
    }
  ]
}

What is the expected behavior?

That sessionId is returned explicite in response to call of codex tool

What do you see instead?

I don't see sessionId for sure...

Additional information

_No response_

View original on GitHub ↗

3 Comments

Faolain · 1 year ago

Duplicate of https://github.com/openai/codex/issues/2434 with PR here https://github.com/openai/codex/pull/2449 (Sitting so long it now has a merge conflict)

MaurUppi · 11 months ago

@chew-z
Quick question, I had a back-and-forth code assessment/improvement task.
I'm assuming codex-reply with sessionId would get the benefit rather than a full re-load (just minor changes) code/doc each new codex call session, right?

etraut-openai contributor · 10 months ago

Closing as duplicate (see #2434).