mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
fix: clean up elicitation used by exec-server (#6958)
Using appropriate message/title fields, I think this looks better now: <img width="3370" height="3208" alt="image" src="https://github.com/user-attachments/assets/e9bbf906-4ba8-4563-affc-62cdc6c97342" /> Though note that in the current version of the Inspector (`0.17.2`), you cannot hit **Submit** until you fill out the field. I believe this is a bug in the Inspector, as it does not properly handle the case when all fields are optional. I put up a fix: https://github.com/modelcontextprotocol/inspector/pull/926
This commit is contained in:
@@ -6,8 +6,6 @@ use rmcp::model::CreateElicitationRequestParam;
|
||||
use rmcp::model::CreateElicitationResult;
|
||||
use rmcp::model::ElicitationAction;
|
||||
use rmcp::model::ElicitationSchema;
|
||||
use rmcp::model::PrimitiveSchema;
|
||||
use rmcp::model::StringSchema;
|
||||
use rmcp::service::RequestContext;
|
||||
|
||||
use crate::posix::escalate_protocol::EscalateAction;
|
||||
@@ -54,12 +52,19 @@ impl McpEscalationPolicy {
|
||||
context
|
||||
.peer
|
||||
.create_elicitation(CreateElicitationRequestParam {
|
||||
message: format!("Allow Codex to run `{command:?}` in `{workdir:?}`?"),
|
||||
#[allow(clippy::expect_used)]
|
||||
message: format!("Allow agent to run `{command}` in `{}`?", workdir.display()),
|
||||
requested_schema: ElicitationSchema::builder()
|
||||
.property("dummy", PrimitiveSchema::String(StringSchema::new()))
|
||||
.title("Execution Permission Request")
|
||||
.optional_string_with("reason", |schema| {
|
||||
schema.description("Optional reason for allowing or denying execution")
|
||||
})
|
||||
.build()
|
||||
.expect("failed to build elicitation schema"),
|
||||
.map_err(|e| {
|
||||
McpError::internal_error(
|
||||
format!("failed to build elicitation schema: {e}"),
|
||||
None,
|
||||
)
|
||||
})?,
|
||||
})
|
||||
.await
|
||||
.map_err(|e| McpError::internal_error(e.to_string(), None))
|
||||
|
||||
Reference in New Issue
Block a user