MCP Server: `codex-reply` tool cannot work because `conversationId` is not returned in result

Resolved 💬 1 comment Opened Dec 21, 2025 by ZhangYiqun018 Closed Dec 21, 2025

MCP Server: codex-reply tool cannot work because conversationId is not returned in result

Summary

When using Codex as an MCP server, the codex-reply tool requires a conversationId parameter, but this ID is not included in the result of the initial codex tool call, making multi-turn conversations impossible.

Environment

  • Codex CLI version: 0.77.0
  • MCP Client: Claude Code
  • OS: Linux

Steps to Reproduce

  1. Configure Codex as MCP server: codex mcp-server
  2. Call the codex tool with a prompt
  3. Attempt to call codex-reply with the conversation ID
  4. Get error: "Session not found"

Expected Behavior

The codex tool result should include the conversationId (session_id) so that codex-reply can be used for multi-turn conversations.

Actual Behavior

The session_id is sent via MCP event notification (codex/event), but NOT included in the final result object:

// Event notification (before result):
{"jsonrpc":"2.0","method":"codex/event","params":{"session_id":"019b4087-c66f-7f93-8e19-f26a7b79cd90",...}}

// Final result (no session_id):
{"id":3,"jsonrpc":"2.0","result":{"content":[{"text":"OK","type":"text"}]}}

MCP clients like Claude Code only receive result.content, so the session_id is lost.

Suggested Fix

Include conversationId in the result object:

{
  "id": 3,
  "jsonrpc": "2.0",
  "result": {
    "content": [{"text": "OK", "type": "text"}],
    "conversationId": "019b4087-c66f-7f93-8e19-f26a7b79cd90"
  }
}

Or add a _meta field as per MCP conventions:

{
  "result": {
    "content": [...],
    "_meta": {
      "conversationId": "..."
    }
  }
}

Workaround

Currently, users must include the full conversation context in each new codex call, which is inefficient and loses the benefits of session-based conversations.

Additional Context

This was discovered while building a Claude Code integration with Codex MCP server. The codex-reply tool is documented but effectively unusable due to this issue.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗