Skip to main content

Module question

Module question 

Source
Expand description

BP-3 (§2 module 6 tools.question, catalog row “Structured user-question tool”): the tool a model uses to ask the USER a multiple-choice or free-text question mid-run, and wait for the answer.

One door, not a new one. The design already names this module’s protocol side: crate::mcp::McpElicitationHandler is documented as “the tools.question surface’s PROTOCOL side (§2.1 dep)”. So this tool does not invent a transport — it asks through that same handler, which under an SDK-owned runtime is the frontend request broker (crate::server::FrontendRequestBridge::elicitation_handler): the request is published into the sequenced frontend event stream as a {"type":"request","request":{…}} envelope and the turn BLOCKS on it until harness.v1.runtimes.respond answers with the content. That is the same broker, the same respond door, and the same request id space the approvals path uses; the two differ only in kind (an approval is allow/deny, a question carries structured answers back), which is exactly why crate::approvals filters non-approval kinds out of its listing.

Headless is deny-default (§2 module 6’s own “⚡ headless print mode (deny-default like OC, oc§1)”): with no handler installed nobody can answer, so the call fails with a message telling the model to decide for itself rather than hanging or silently inventing an answer.

Shape. AskUserTool takes Claude Code’s AskUserQuestion shape — 1-4 questions, each with a short header, 1-4 labelled options, an optional multiSelect, and (always) a free-text fallback. The same tool object is registered under Codex’s experimental spelling REQUEST_USER_INPUT when a preset asks for it, so a continued Codex session’s own tool name keeps resolving.

Structs§

AskUserTool
The structured user-question tool. name is the registered spelling — ASK_USER under cc-parity, additionally REQUEST_USER_INPUT under cx-parity.
Question
One question in an AskUserTool call.
QuestionOption
One selectable answer.
UserQuestionHandler
The handler ask_user asks through, wrapped so ToolContext can stay Debug — the same newtype shape (and the same reason) as crate::tools::ToolApprovalHandler.

Constants§

ASK_USER
Registered name of the question tool (Claude Code’s AskUserQuestion).
MAX_OPTIONS
At most four options per question (the CC shape’s own cap).
MAX_QUESTIONS
Claude Code’s cap: at most four questions in one call.
REQUEST_USER_INPUT
Codex’s experimental spelling for the same capability (cx§1 request_user_input), registered as an alias under cx-parity.