feat(app-server): support mcp elicitations in v2 api#13425
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c23ca48846
ℹ️ 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".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
| /// server-to-client request, not a turn- or tool-call-scoped primitive. | ||
| pub turn_id: Option<String>, | ||
| pub server_name: String, | ||
| pub message: String, |
There was a problem hiding this comment.
Can we use the standard MCP elicit request payload here? I think that's the rich metadata that the group was talking about. It already comes with rmcp: rmcp::Model::CreateElicitationRequestParams
There was a problem hiding this comment.
had to define a copy of it in v2.rs to be able to export it properly to typescript and json schema, but it's the same shape
| #[serde(rename_all = "camelCase")] | ||
| #[ts(export_to = "v2/")] | ||
| pub struct McpServerElicitationRequestResponse { | ||
| pub action: McpServerElicitationAction, |
There was a problem hiding this comment.
Same here, can we use the standard MCP elicit response?
There was a problem hiding this comment.
same as above - had to define a copy of it in v2.rs to be able to export it properly to typescript and json schema, but it's the same shape
7bd8712 to
97ee4dd
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
This adds a first-class server request for MCP server elicitations:
mcpServer/elicitation/request.Until now, MCP elicitation requests only showed up as a raw
codex/event/elicitation_requestevent from core. That made it hard for v2 clients to handle elicitations using the same request/response flow as other server-driven interactions (like shell andapply_patchtools).This also updates the underlying MCP elicitation request handling in core to pass through the full MCP request (including URL and form data) so we can expose it properly in app-server.
Why not
item/mcpToolCall/elicitationRequest?This is because MCP elicitations are related to MCP servers first, and only optionally to a specific MCP tool call.
In the MCP protocol, elicitation is a server-to-client capability: the server sends
elicitation/create, and the client replies with an elicitation result. RMCP models it that way as well.In practice an elicitation is often triggered by an MCP tool call, but not always.
What changed
mcpServer/elicitation/requestto the v2 app-server APIcodex/event/elicitation_requestevents into the new v2 server requestOp::ResolveElicitationso the MCP server can continueapp-server API flow
thread/start.turn/start.item/startedfor themcpToolCall.mcpServer/elicitation/request.{ action: "accept" | "decline" | "cancel" }.serverRequest/resolved.item/completedfor the mcpToolCall.turn/completed.serverRequest/resolvedbefore the turn finishes.