---
title: "@henryqw/pi-ask-question"
seo:
  description: "Ask Pi users one interactive question with choices or a custom answer."
---

<div class="not-prose my-6 flex flex-wrap items-center gap-3"><span class="text-sm text-muted-foreground">v0.2.3</span><a href="https://www.npmjs.com/package/@henryqw/pi-ask-question" aria-label="View @henryqw/pi-ask-question on npm"><img alt="Monthly npm downloads" height="20" src="https://img.shields.io/npm/dm/%40henryqw%2Fpi-ask-question?cacheSeconds=7200&amp;color=1d4ed8&amp;label=downloads&amp;labelColor=101828&amp;style=flat-square" width="144"></a></div>

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

![Pi asking the user to choose a database](https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-ask-question/example.png)

## Why

- **Created for**: Ask the user one interactive question with up to three choices during a Pi session.
- **Advantage**: Show a keyboard-selectable prompt and return one explicit answer instead of parsing free-form chat.

## Install

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

## Use

Use `ask_question` to pause for one interactive answer.

```json
{
  "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.
- The UI marks the first option `(Recommended)`.
- The UI adds `Something else.`, which opens a text input for a custom answer.

The tool returns an error for empty questions, blank or duplicate labels, empty lists, more than three options, and non-interactive sessions. Aborting the tool closes the pending question.

Extensions can reuse the validated interaction with `askQuestion(params, ctx, signal)`. This package export returns the tool's answer details without registering another UI flow.
