Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 1.14 KB

File metadata and controls

33 lines (24 loc) · 1.14 KB

@henryqw/pi-ask-question

Ask the user one interactive question with up to three choices, or a custom answer.

Why

  • Created for: Asking the user one interactive question with up to three choices during a Pi session.
  • Advantage: Offers a keyboard-selectable prompt and returns one explicit answer instead of relying on free-form chat parsing.

Install

pi install npm:@henryqw/pi-ask-question

Use

Surface Type Purpose
ask_question tool Pause for one interactive answer.
{
  "question": "Which database should we use?",
  "options": [
    { "label": "PostgreSQL", "description": "Shared server database" },
    { "label": "SQLite", "description": "Local, embedded storage" },
    { "label": "File", "description": "Plain file storage" }
  ]
}

Supply one to three options in preference order. UI marks the first (Recommended) and adds Something else., which opens a text input for a custom answer. Empty questions, blank or duplicate labels, empty lists, more than three options, and non-interactive sessions return an error. Aborting the tool closes the pending question.