Skip to content

Conversation

@yuvrajangadsingh
Copy link
Contributor

Summary

  • When a user accepts an MCP elicitation request, send content: Some(json!({})) instead of None
  • MCP servers that use elicitation expect content to be present when action is Accept
  • This matches the expected behavior shown in tests at exec-server/tests/common/lib.rs:171

Root Cause

In codex-rs/core/src/codex.rs, the resolve_elicitation function always sent content: None:

let response = ElicitationResponse {
    action,
    content: None,  // Always None, even for Accept
};

Fix

Send an empty object when accepting:

let content = match action {
    ElicitationAction::Accept => Some(serde_json::json!({})),
    ElicitationAction::Decline | ElicitationAction::Cancel => None,
};

Test plan

  • Code compiles with cargo check -p codex-core
  • Formatted with just fmt
  • Integration test accept_elicitation_for_prompt_rule (requires MCP server binary)

Fixes #9053

@etraut-openai
Copy link
Collaborator

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@yuvrajangadsingh yuvrajangadsingh force-pushed the fix/elicitation-content-on-accept branch 2 times, most recently from 4b4e3a9 to c7272ff Compare January 14, 2026 09:36
When a user accepts an MCP elicitation request, send `content: Some(json!({}))`
instead of `None`. MCP servers that use elicitation expect content to be
present when action is Accept.

Fixes openai#9053
// When accepting, send an empty object as content to satisfy MCP servers
// that expect non-null content on Accept. For Decline/Cancel, content is None.
let content = match action {
ElicitationAction::Accept => Some(serde_json::json!({})),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable.

FYI, I did some related work on the MCP Inspector: modelcontextprotocol/inspector#926.

@bolinfest bolinfest merged commit 004a749 into openai:main Jan 15, 2026
26 of 32 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2026
@yuvrajangadsingh yuvrajangadsingh deleted the fix/elicitation-content-on-accept branch January 16, 2026 22:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Elicitation fails with NoContent error when client sends empty content on Accept

3 participants