Skip to content

Commit 934fc8d

Browse files
authored
fix: clean up elicitation used by exec-server (openai#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: modelcontextprotocol/inspector#926
1 parent ccf8d76 commit 934fc8d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

codex-rs/exec-server/src/posix/mcp_escalation_policy.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use rmcp::model::CreateElicitationRequestParam;
66
use rmcp::model::CreateElicitationResult;
77
use rmcp::model::ElicitationAction;
88
use rmcp::model::ElicitationSchema;
9-
use rmcp::model::PrimitiveSchema;
10-
use rmcp::model::StringSchema;
119
use rmcp::service::RequestContext;
1210

1311
use crate::posix::escalate_protocol::EscalateAction;
@@ -54,12 +52,19 @@ impl McpEscalationPolicy {
5452
context
5553
.peer
5654
.create_elicitation(CreateElicitationRequestParam {
57-
message: format!("Allow Codex to run `{command:?}` in `{workdir:?}`?"),
58-
#[allow(clippy::expect_used)]
55+
message: format!("Allow agent to run `{command}` in `{}`?", workdir.display()),
5956
requested_schema: ElicitationSchema::builder()
60-
.property("dummy", PrimitiveSchema::String(StringSchema::new()))
57+
.title("Execution Permission Request")
58+
.optional_string_with("reason", |schema| {
59+
schema.description("Optional reason for allowing or denying execution")
60+
})
6161
.build()
62-
.expect("failed to build elicitation schema"),
62+
.map_err(|e| {
63+
McpError::internal_error(
64+
format!("failed to build elicitation schema: {e}"),
65+
None,
66+
)
67+
})?,
6368
})
6469
.await
6570
.map_err(|e| McpError::internal_error(e.to_string(), None))

0 commit comments

Comments
 (0)