ask-user-question

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Ask User Question

向用户提问

Use this MCP tool to ask users questions and get their responses. This is the ONLY way to communicate with the user - they cannot see CLI/terminal output.
使用此MCP工具向用户提问并获取他们的回复。这是你与用户沟通的唯一方式——用户无法查看CLI/终端输出。

Critical Rule

重要规则

The user CANNOT see your text output or CLI prompts!
If you write "Let me ask you..." and then just output text - THE USER WILL NOT SEE IT. You MUST call this tool to display a modal in the UI.
用户无法看到你的文本输出或CLI提示!
如果你写下“我来问你...”然后直接输出文本——用户将看不到这些内容。 你必须调用此工具才能在UI中显示一个弹窗。

When to Use

适用场景

  • Clarifying questions before starting ambiguous tasks
  • Asking user preferences (e.g., "How would you like files organized?")
  • Confirming actions before executing (especially destructive/irreversible ones)
  • Getting approval for sensitive actions (financial, messaging, deletion, etc.)
  • Any situation where you need user input to proceed
  • 在开始模糊任务前提出澄清问题
  • 询问用户偏好(例如:“你希望如何整理文件?”)
  • 在执行操作前确认(尤其是破坏性/不可逆操作)
  • 获取敏感操作的批准(财务、消息发送、删除等)
  • 任何需要用户输入才能继续的情况

Parameters

参数

json
{
  "questions": [{
    "question": "Your question to the user",
    "header": "Short label (max 12 chars)",
    "options": [
      { "label": "Option 1", "description": "What this does" },
      { "label": "Option 2", "description": "What this does" }
    ],
    "multiSelect": false
  }]
}
  • question
    (required): The question text to display
  • header
    (optional): Short category label, shown as modal title (max 12 chars)
  • options
    (optional): Array of selectable choices (2-4 recommended)
  • multiSelect
    (optional): Allow selecting multiple options (default: false)
Custom text input: To allow users to type their own response, include an option with label "Other" (case-insensitive). When selected, the UI shows a text input field.
json
{ "label": "Other", "description": "Type your own response" }
Important: When "Other" is selected, the response will be
User responded: [their text]
instead of
User selected: Other
. You must wait for and handle this text response - do NOT proceed as if they selected a predefined option.
json
{
  "questions": [{
    "question": "Your question to the user",
    "header": "Short label (max 12 chars)",
    "options": [
      { "label": "Option 1", "description": "What this does" },
      { "label": "Option 2", "description": "What this does" }
    ],
    "multiSelect": false
  }]
}
  • question
    (必填):要显示的问题文本
  • header
    (可选):简短的分类标签,作为弹窗标题显示(最多12个字符)
  • options
    (可选):可选择的选项数组(建议2-4个)
  • multiSelect
    (可选):允许多选(默认:false)
自定义文本输入:若要允许用户输入自定义回复,需添加一个标签为“Other”(不区分大小写)的选项。选中该选项后,UI会显示一个文本输入框。
json
{ "label": "Other", "description": "Type your own response" }
注意:当选中“Other”时,回复格式将为
User responded: [their text]
,而非
User selected: Other
。你必须等待并处理此文本回复——不要像处理预定义选项那样继续操作。

Examples

示例

Asking about organization preferences

询问整理偏好

AskUserQuestion({
  "questions": [{
    "question": "How would you like to organize your Downloads folder?",
    "header": "Organize",
    "options": [
      { "label": "By file type", "description": "Group into Documents, Images, Videos, etc." },
      { "label": "By date", "description": "Group by month/year" },
      { "label": "By project", "description": "You'll help me name project folders" }
    ]
  }]
})
AskUserQuestion({
  "questions": [{
    "question": "How would you like to organize your Downloads folder?",
    "header": "Organize",
    "options": [
      { "label": "By file type", "description": "Group into Documents, Images, Videos, etc." },
      { "label": "By date", "description": "Group by month/year" },
      { "label": "By project", "description": "You'll help me name project folders" }
    ]
  }]
})

Confirming a destructive action

确认破坏性操作

AskUserQuestion({
  "questions": [{
    "question": "Delete these 15 duplicate files?",
    "header": "Confirm",
    "options": [
      { "label": "Delete all", "description": "Remove all 15 duplicates" },
      { "label": "Review first", "description": "Show me the list before deleting" },
      { "label": "Cancel", "description": "Don't delete anything" }
    ]
  }]
})
AskUserQuestion({
  "questions": [{
    "question": "Delete these 15 duplicate files?",
    "header": "Confirm",
    "options": [
      { "label": "Delete all", "description": "Remove all 15 duplicates" },
      { "label": "Review first", "description": "Show me the list before deleting" },
      { "label": "Cancel", "description": "Don't delete anything" }
    ]
  }]
})

Simple yes/no confirmation

简单的是/否确认

AskUserQuestion({
  "questions": [{
    "question": "Should I proceed with sending this email?",
    "header": "Send email",
    "options": [
      { "label": "Send", "description": "Send the email now" },
      { "label": "Cancel", "description": "Don't send" }
    ]
  }]
})
AskUserQuestion({
  "questions": [{
    "question": "Should I proceed with sending this email?",
    "header": "Send email",
    "options": [
      { "label": "Send", "description": "Send the email now" },
      { "label": "Cancel", "description": "Don't send" }
    ]
  }]
})

Response Format

回复格式

The tool returns the user's selection:
  • User selected: By file type
    - Single selection
  • User selected: Option A, Option B
    - Multiple selections (if multiSelect: true)
  • User responded: [custom text]
    - If user typed a custom response
  • User declined to answer the question.
    - If user dismissed the modal
此工具会返回用户的选择:
  • User selected: By file type
    - 单选
  • User selected: Option A, Option B
    - 多选(当multiSelect: true时)
  • User responded: [custom text]
    - 用户输入自定义回复时
  • User declined to answer the question.
    - 用户关闭弹窗时

Wrong vs Correct

错误示例 vs 正确示例

WRONG (user won't see this):
I'll help organize your files. How would you like them organized?
- By type
- By date
- By project
CORRECT (user will see a modal):
AskUserQuestion({
  "questions": [{
    "question": "How would you like your files organized?",
    "options": [
      { "label": "By type" },
      { "label": "By date" },
      { "label": "By project" }
    ]
  }]
})
错误(用户看不到):
I'll help organize your files. How would you like them organized?
- By type
- By date
- By project
正确(用户会看到弹窗):
AskUserQuestion({
  "questions": [{
    "question": "How would you like your files organized?",
    "options": [
      { "label": "By type" },
      { "label": "By date" },
      { "label": "By project" }
    ]
  }]
})